New Xampp Email Problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

New Xampp Email Problem

Postby jperson19468 » 10. November 2017 03:39

Trying to configure Xamp v3.2.2 to send email
I receive no error messages and no email(s)

This is what I have in my php.ini File

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
; http://php.net/smtp-port
;smtp_port=25

SMTP=smtp.gmail.com
;smtp_port=587
sendmail_from = xxxxxx@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

This is what I have in my sendmail.ini File
; configuration for fake sendmail

[sendmail]

smtp_server=ssl://smtp.gmail.com
smtp_port=465
auth_username=xxxxxxx@gmail.com
auth_password=1234567

Thank You
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Nobbie » 10. November 2017 10:38

This looks wrong:

smtp_server=ssl://smtp.gmail.com

Where did you find that? A server usually is only a plain name (smtp.gmail.com), but you applied an URL, which preceeds the protocoll ssl (and even that looks wrong), it could be smtp:// instead but i dont think so. If you like to send encrypted, there should be an option for that in sendmail.ini, but dont preceed the server with something strange.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: New Xampp Email Problem

Postby jperson19468 » 10. November 2017 21:13

smtp_server=ssl://smtp.gmail.com has been removed

This is what my sendmail.ini file looks like now
; configuration for fake sendmail

[sendmail]

smtp_port=465
auth_username=xxxxxxx@gmail.com
auth_password=1234567

Thank You
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby jperson19468 » 11. November 2017 01:32

Still no email or error messages
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Nobbie » 11. November 2017 10:47

Do you show us the full contents of sendmail.ini?
And what is your PHP script for testing? Please show us the code.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: New Xampp Email Problem

Postby jperson19468 » 12. November 2017 02:03

I am trying/using fake sendmail to send email
This is what I have in the sendmail.ini file

; configuration for fake sendmail

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=xxxxx@gmail.com
auth_password=xxxxxxxx
force_sender=xxxxxx@gmail.com

Program trying to send email:
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Members Page</title>
<LINK HREF="ct.css" REL="stylesheet" TYPE="text/css">
</head>

<body>
<DIV id="contentMain1other">
<p align="center" class=main_titles>
Email the Members Form
</p>
</DIV> <!-- end contentMain1other -->

<DIV id="othercontentarea">
<br/>
<DIV id="div_line">
<?php
require_once "dbconfig.php"; // include the database information
ini_set('display_errors', 1);
error_reporting(E_ALL);
if(!isset($_POST['submit'])){?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
If you need to send email with a <a href="sendmixed2.php">Attachment Click Here</a>
<br><br>
Email Subject Line:
<span class="e_message_tag"><?php
print '<input name="email_subject_line" size="40" maxlength="25"/>';?>
</span>
</DIV> <!-- end divline -->
<br/>
Email Message Body:<br/><?php
print "<textarea cols=\"50\" rows=\"10\" name=\"email_message_body\"
wrap=\"virtual\"></textarea>";?>
<br/>
<P><br>
<INPUT class=submit_reset type="submit" name="submit" value="Submit"/>
<input type=reset value="Reset"/>
</p>
</form>
<?php
}else{
$to = 'jperson19468@gmail.com';
$email_subject_line = $_POST['email_subject_line'];
$email_message_body = $_POST['email_message_body'];
$email_subject_line = mysqli_real_escape_string($conn,$email_subject_line);

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

if (strlen($email_subject_line) == 0 ||
strlen($email_message_body) == 0){
echo "Email Subject Line and Email Message Body must all be completed!";
exit;
}
$fh = fopen('the_datafile.txt','rb');
for ($line = fgets($fh); ! feof($fh); $line = fgets($fh)) {
$line = trim($line);
$info = explode(',', $line);

$querystring = "select email, first_name
from member";
$the_result = mysqli_query($conn,$querystring);
if (!$the_result){
echo "Something went wrong during the query. MySQL said: ".mysqli_error($conn);
exit;
}
}
fclose($fh);

while ($row = mysqli_fetch_array($the_result,MYSQLI_ASSOC)) {
mail("$row[email]", $email_subject_line,
"$email_message_body",
"Hello ".$row["first_name"],$headers);
}
echo "done";
}
?>
</body>
</html>
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Nobbie » 12. November 2017 16:35

> smtp_port=465
> smtp_port=25

What??

Sorry, but i cannot debug that code for you, i cannot even see if there is any data in MySQL which is found by your formular. Maybe there is no mail sent due to no hits. You also applied different sendmail.ini here, this is chaotic (sorry, but it is) and finally your sendmail.ini totally lacks the setting for smtp_ssl. You have to debug that on yourself, it is quite impossible for me to see if there is any error in Xampp (what i doubt).
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: New Xampp Email Problem

Postby jperson19468 » 12. November 2017 23:05

OK this is what I have done.
I have downloaded a default copy of fake sendmail for windows. I change sendmail.ini file it a little bit. I will post it here. I am using that copy now.
I have also changed around the send email program and made it more simpler. No database is used. It should just email two input items from the screen that are entered and a constant I will also post that.

sendmail.ini

; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory. (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

smtp_server=smtp.gmail.com

; smtp port (normally 25)

smtp_port=25

; SMTPS (SSL) support
; auto = use SSL for port 465, otherwise try to use TLS
; ssl = alway use SSL
; tls = always use TLS
; none = never try to use SSL

smtp_ssl=auto

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

;default_domain=mydomain.com

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

;debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

auth_username=jperson19468@gmail.com
auth_password=xxxxxx

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines. do not enable unless it is required.

;pop3_server=
;pop3_username=
;pop3_password=

; force the sender to always be the following email address
; this will only affect the "MAIL FROM" command, it won't modify
; the "From: " header of the message content

force_sender=jperson19468@gmail.com

; force the sender to always be the following email address
; this will only affect the "RCTP TO" command, it won't modify
; the "To: " header of the message content

;force_recipient=

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required

;hostname=

; configuration for fake sendmail

[sendmail]

smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=jperson19468@gmail.com
auth_password=xxxxx
force_sender=jperson19468@gmail.com

sendemail1

<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Members Page</title>
<LINK HREF="ct.css" REL="stylesheet" TYPE="text/css">
</head>
<body>
<DIV id="othercontentarea">
<br/>
<DIV id="div_line">
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
if(!isset($_POST['submit'])){?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
Email Subject Line:
<span class="e_message_tag"><?php
print '<input name="email_subject_line" size="40" maxlength="25"/>';?>
</span>
</DIV> <!-- end divline -->
<br/>
Email Message Body:<br/><?php
print "<textarea cols=\"50\" rows=\"10\" name=\"email_message_body\"
wrap=\"virtual\"></textarea>";?>
<br/>
<P><br>
<INPUT class=submit_reset type="submit" name="submit" value="Submit"/>
<input type=reset value="Reset"/>
</p>
</form>
<?php
}else{
$to = 'jperson19468@gmail.com';
$email_subject_line = $_POST['email_subject_line'];
$email_message_body = $_POST['email_message_body'];
$email_subject_line = $_POST['email_subject_line'];

$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$first_name ='jerome greene';

mail($to, $email_subject_line,$email_message_body,
'Hello '.$first_name,$headers);

echo "done";

echo "<br/>";
echo 'email '.$to;
echo "<br/>";
echo 'email_subject_line '.$email_subject_line;
echo "<br/>";
echo 'email_message_body '.$email_message_body;
echo "<br/>";
echo 'first_name '.$first_name;
}
?>
</body>
</html>
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Nobbie » 12. November 2017 23:16

Due to gmail documentation, smtp.gmail.com does not support port 25. This is my last reply here, i give up. Good luck.
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: New Xampp Email Problem

Postby jperson19468 » 25. November 2017 03:14

Could not get fake sendmail to work
I have found another program called PHPMailer.
It can be found at:
https://github.com/PHPMailer
It took me a little work, but it started emailing for me as of today
For those of you who wish to see my test code please response back to this thread and I can see what I can do
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Nobbie » 25. November 2017 11:50

I recommend using PHPMailer Class already since a couple of years and there is already some example code in this forum. But of course it also means, that you have to use a different PHP code for mails, you cannot use mail() function in your code. This might be a problem for those projects, where mail() function is already implemented (and it is not your code).
Nobbie
 
Posts: 13183
Joined: 09. March 2008 13:04

Re: New Xampp Email Problem

Postby jperson19468 » 25. November 2017 17:49

What Nobbie said is true. If you have the mail() function in your code you may have to do some work. I would use PHPMailer Class going forward.
I only have have 5 programs I need to adjust to use PHPMailer Class.

Here is a list from https://github.com/PHPMailer/PHPMailer/tree/master/examples website of other mail testing tools you might like to try:

FakeSMTP, a Java desktop app with the ability to show an SMTP log and save messages to a folder.
FakeEmail, a Python-based fake mail server with a web interface. (I could not get this one to work)
smtp-sink, part of the Postfix mail server, so you may have this installed already. This is used in the Travis-CI configuration to run PHPMailer's unit tests.
smtp4dev, a dummy SMTP server for Windows.
fakesendmail.sh, part of PHPMailer's test setup, this is a shell script that emulates sendmail for testing 'mail' or 'sendmail' methods in PHPMailer.
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Chikwado » 26. November 2017 18:21

Have You Try To TroubleShoot These Program And See If It's Working? Example: C:\xampp\sendmail\sendmail.exe. If It's Not Working, Then It's Difficult That You Will Send Mail In Xampp.
Window8.1 32bits, Code:Block/mingw, web, server, network and latest wine.
User avatar
Chikwado
 
Posts: 39
Joined: 16. July 2014 13:44
Location: Abuja, Nigeria.
XAMPP version: 3.2/php 7.2
Operating System: Window 8.1 32bits

Re: New Xampp Email Problem

Postby jperson19468 » 26. November 2017 19:17

After I read that Xampp does not send email I tried FakeEmail. I could not get that work but PHPMailer is working fine for me. I just have to work into my mail logic only 5 programs to start with
jperson19468
 
Posts: 16
Joined: 27. February 2015 02:48
XAMPP version: v3.2.2
Operating System: windows 10

Re: New Xampp Email Problem

Postby Chikwado » 26. November 2017 19:54

After I Read That xampp does not send mail
The Statement There Was Not That Xampp Does Not Send Mail. For Example, Take The Following Step To Verify If Sendmail.exe Is Working. Navigate To C:\xampp\sendmail\sendmail.exe Righ-click Sendmail.exe Select "Troubleshooting" Follow All The Processing And See If You Would Get A Success Or Error Message. You Can Send Mail In Xampp But It Require Some Setup And Configurations.
Window8.1 32bits, Code:Block/mingw, web, server, network and latest wine.
User avatar
Chikwado
 
Posts: 39
Joined: 16. July 2014 13:44
Location: Abuja, Nigeria.
XAMPP version: 3.2/php 7.2
Operating System: Window 8.1 32bits

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 107 guests