Help with Xampp and the mail function

moose517

Gawd
Joined
Feb 28, 2009
Messages
640
I'm having difficulties with xampp and the mail function as the title says, according to the log file its sending however its not. I send myself test massges and never receive anything.

here is the relevant code from my php.ini
Code:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP =smtp.gmail.com

; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = ”C:\xampp\sendmail\sendmail.exe -t”

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log = "\xampp\php\logs\php_mail.log"

as well as the php code for sending the email
Code:
<?php
    //we need to get our variables first
    
    $email_to =   '[email protected]'; //the address to which the email will be sent
    $name     =   $_POST['contact_name'];  
    $email    =   $_POST['contact_email'];
    $subject  =   $_POST['contact_subject'];
    $message  =   $_POST['contact_message'];
    
    /*the $header variable is for the additional headers in the mail function,
     we are asigning 2 values, first one is FROM and the second one is REPLY-TO.
     That way when we want to reply the email gmail(or yahoo or hotmail...) will know 
     who are we replying to. */
    $headers  = "From: ". $email . "\r\n";
    $headers .= "Reply-To: " . $email . "\r\n";
    
    if(mail($email_to, $subject, $message, $headers)){
        echo 'sent'; // we are sending this text to the ajax request telling it that the mail is sent..      
    }else{
        echo 'failed';// ... or this one to tell it that it wasn't sent    
    }
?>

I know the mail function is returning true as on the page it displays sent. I also checked my gmail account and all the emails are supposed to work so i dunno what the problem is.
 
Doesn't Google require authentication to send mail? It looks like you are trying to anonymously request them to send mail on your behalf.
 
Doesn't Google require authentication to send mail? It looks like you are trying to anonymously request them to send mail on your behalf.

You can choose whatever sender you want. I can send you an email from [email protected]. He is not sending anything through gmail.

Anyways.

I am not a Xampp user myself and I could be wrong on what I am about to say, but where are you sending these emails from? If the logs show that emails are being sent, then maybe the problem lies somewhere else, perhaps with your ISP.

Maybe.
 
i wondered the same thing but having a business account i sure would hope they wouldn't be filtering SMTP traffic like i know some do on standard accounts.
 
Do you happen to have a Linux box? Try sendmail through there. If that doesn't work, then most likely the problem lies somewhere else.
 
i do have a linux VM i just setup actually as i was thinking of moving my web server to linux. I don't have any web stuff setup on it though yet.
 
You can choose whatever sender you want. I can send you an email from [email protected]. He is not sending anything through gmail.

Anyways.

I am not a Xampp user myself and I could be wrong on what I am about to say, but where are you sending these emails from? If the logs show that emails are being sent, then maybe the problem lies somewhere else, perhaps with your ISP.

Maybe.

I didn't mean setting the from address, that's irrelevant. He has smtp.gmail.com as his smtp server, but he is not using any credentials to connect to it.
 
Use SSMTP for this instead of sendmail. Just make sure you turn on TLS support in the config.
 
is that for windows as well?

Nope. You said you were moving over to a Linux VM, which was why I mentioned it. There's just not a lot of options for doing this on Windows.

I believe your problem is that the version of sendmail you are using isn't compiled with TSL and SASL support, because they aren't default (or you have it configured wrong). You can recompile it yourself with gcc, but it's gonna be much easier to just move to Linux, use another SMTP server or set up your own relay using a tool other than sendmail (you could use an Exchange server for this, but it would be a massive waste of resources).

If you want to stick with sendmail, this post contains the instructions for getting it set up for GMail's relay: (for Linux, but the same basic setup is required for Windows)
http://www.phinesolutions.com/sendmail-gmail-smtp-relay-howto.html
 
Back
Top