Page 1 of 1

Send e-mail not working

PostPosted: 27. March 2012 21:45
by mickeymouse
I want to send an e-mail to my user but it's not working.
I believe it's an installation problem but that's all I know.

My code is:
mail($to,$subject,$message,$headers); //this is line 73
and I'm sure my parameters are correct.

The msg I get is:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Annuaire\AF_Forgot.php on line 73

Thanks for your help
Mickey

Re: Send e-mail not working

PostPosted: 27. March 2012 22:22
by Sharley
See if your solution is within these forum search results for sendmail solved

Or in these for sendmail without the solved added.

Good luck. :)

Re: Send e-mail not working

PostPosted: 28. March 2012 19:47
by mickeymouse
I changes my XAMPP to version 1.7.7 and now, when I try to send an e-mail, I get:

Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\Annuaire\AF_Forgot.php on line 73

What does this mean "non-local mail".

I'm trying to test my code to see if the message get through by sending the e-mail to my own hotmail.com box.

Thanks

Re: Send e-mail not working

PostPosted: 28. March 2012 23:14
by Sharley
Without knowing if you installed the latest sendmail, found in the above search results for 1.7.7 or how you have configured the sendmail.ini file and the php.ini file, then it will be impossible to answer your question effectively.
You can obfuscate any sensitive data you don't want made public on the forum.

Please read this forum announcement:
viewtopic.php?f=16&t=48331
Thanks. :)

Re: Send e-mail not working

PostPosted: 30. March 2012 12:11
by mickeymouse
The Forum Announcment you refer me to askes that I inform you as to which Control Panel version I'm using. It is 2.5 (which came with my downloading of XAMPP 1.7.7) My profile is up to date but there is no place for me to show this CP version.

Concerning my e-mail sending problem, you say "Without knowing if you installed the latest sendmail..." I simply downdloaded XAMPP V1.7.7. I didn't do anything for "sendmail"; there were no options for me to select, it is whatever came with the download and I presume it would be the latest. As for configuring sendmail.ini and php.ini files, I didn't do anything there either. I wasn't aware that I should. If I am, I have absolutly no idea of what/how I should configure. I have read both files. Neither of them seem to have much relevant to sending mail. All I could find (in PHP.ini) was
SMTP = localhost
smtp_port = 25
I'm not having problems with the port, so no need to change that and for SMTP, I can only assume that 'localhost' is correct
and since I have absolutly no idea what is done with this, I can't figure out what else it should be.

I have read the POSTS you refer me to but none of them address this problem/message which I'm getting, i.e., 'We do not relay non-local mail'.

I'll keep working on it but your assistance so far and any further assistance is greatly appreciated.

Re: Send e-mail not working

PostPosted: 08. April 2012 16:10
by DesktopSages
I hope this helps everyone. While attempting to use the mail(); function in PHP I also received the error:

Warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry.

I fixed it as follows:

1. Open XAMPP Control Panel

2. Click "Admin..." next to Mercury.

3. In the Mercury/32 window click "Configuration"

4. Click "MercuryS SMTP Server".

5. Click the "Connection control" tab.

6. Take the check out of "Do not permit SMTP relaying of non-local mail" and click "OK".

7. Close the "Mercury/32" window and run your script again.

That should do it.

Re: Send e-mail not working

PostPosted: 19. April 2012 23:22
by mickeymouse
Thanks DesktopSage.
I tried it and it does get rid of the 'non relaying of local mail' message but it doesn't send the e-mail;
at least, the recipient (me) does not get the e-mail.

Re: Send e-mail not working

PostPosted: 21. April 2012 12:11
by Hamish
I have exactly the same problem. Did you finally get an answer?

'H'

Re: Send e-mail not working

PostPosted: 24. April 2012 21:42
by mickeymouse
My dear Hamish,
So sorry. i didn't get an answer. I guess no one knows the answer.
But I haven't given up so keep checking this item.
Mickey

Re: Send e-mail not working

PostPosted: 26. April 2012 21:42
by Hamish
Mickey,

See my post on this subject (re sending email using php) - it may help. If it does - super.

Regards,

'H'

Re: Send e-mail not working

PostPosted: 26. April 2012 21:44
by Hamish
Mickey,

Sorry - wrong post: it should be 'Debugging email connection@. That should see you right.

'H'

Re: Send e-mail not working

PostPosted: 30. April 2012 13:53
by mickeymouse
I changed my php.ini and sendmail.ini to exactly what you have in Debugging email connection@.
I also set up error.log and debug.log in same folder as sendemail.exe
I used your same send mail code, i.e.,

<?php
$email_to = "my_email_address_here";
$name="Harry";
$email="my_email_address_here";
$phone="0247123456";
$email_subject = 'Feedback from website';
$headers = 'From: me@there.com\r\n';
$message='Name: ' .$name. "\r\n". 'Email: ' .$email. "\r\n". 'Phone: ' .$phone;
$sent = mail($email_to, $email_subject, $message, $headers);
if($sent)
{print "Your mail was sent successfully to $email_to"; }
else
{print "We encountered an error sending your mail"; }
?>

The result is the same as I had before - I get the message that the email was successfully sent but the email is never actually sent or at least it is never received by the $email_to addressee.
Also, i get no error messages in any of the logs, actually no message at all.

Thankfull (& frustrated),
Mickey