Hi!
I am using drupal from localhost for my degree exercise.
I have made a contact form and when i hit the 'send email' button it displayes me this message:

"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\drupal\includes\mail.inc on line 193." .

However there is no mail.inc file in the directory above! There is just a mail.php file...what should i do?

Thanks in advance!

Comments

Elteto’s picture

What mail server are you running on the local machine? I have seen the same error message when a mail server is not installed or running at all...

===================
http://www.elteto.net

Elteto’s picture

I am not certain, does XAMPP come with Mercury Mail?

===================
http://www.elteto.net

johnkary’s picture

Yes, XAMPP comes with mercury mail...I just activated Mercury email and now when i send an email it displays me that:
"warning: mail() [function.mail]: SMTP server response: 553 We do not relay non-local mail, sorry. in C:\xampp\htdocs\drupal\includes\mail.inc on line 193."

sapark’s picture

I believe that's a, probably default, security setting in mercury mail so evil users can not use your mail server to send junk to the rest of the world (non-local). It can send to users on the machine (local).

here's more info:
"If you get the error message "SMTP server response: 553 We do not relay non-local mail, sorry." while sending from PHP go to Mercury under MercuryS -> Connection Control -> "Uncheck Do not Permit SMTP relaying to non-local mail" an check this option. Should fix the problem. Thanks to ron!" http://www.zoe.vc/2008/mercury-mail-transport-system-fur-externe-mail-ko...

kendouglass’s picture

I found the most helpful information at "Managing Mail Handling for Development or Testing." See here: http://drupal.org/node/201981

mattyoung’s picture

Don't bother with Mercury. Use sendmail.exe.

You need to have access to a smtp server.

1) edit xampp/sendmail/sendmail.ini, enter you smpt login username/password/port

1A) if your smtp server requires TLS secure socket, for example, google's smtp.gmail.com server, then use http://sourceforge.net/projects/msmtp/

Test your sendmail.exe/msmtp.exe setup

create a mail.txt text file with content:

to: youremail@somewhere.com
from: yourself@somewhere.com
subject: Test sendmail from me

blah blah blah

In the sendmail.exe directory, run:

sendmail -t < mail.txt

or in the msmtp directory:

msmtp -t < mail.txt

Check your email is received. If you use web mail and don't see the email in inbox, check the spam folder!

If sendmail works:

2) edit xampp/apache/bin/php.ini to make php send email with sendmail.exe or msmtp.exe. Look for the [mail function] section. You want to set:

sendmail_path="C:\xampp\sendmail\sendmail.exe -t -i"

or msmtp.exe

restart apache and try to send email from drupal.

perisdr’s picture

Was able to send mails using this!

jnettik’s picture

I'm getting the same error on my set up using WAMP. I'm also using localhost for now to learn drupal. Do any of these solutions carry over or is there a WAMP specific one?

James

vm’s picture

if you are only learning there is no issue with not being able to send mail. Drupal will function perfectly well albeit without sending emails.

If you want emails to be sent in localhost you need to install a mailserver or be able in some way to connect to one.

Stomper’s picture

So I forgot my password to the admin/UID1/god account. I'm running XAMPP and tried to email a new password, but am not sure if its working. I turned on Mercury, but still nothing. Do I need to configure Mercury or just click "run"?

If I can't do it, what do I do? Can I get back admin access or do I have to reinstall Drupal on XAMPP all over again?

Thanks

vm’s picture

Stomper’s picture

Thanks, this should be added to the install guide for XAMPP. I got impatient and just reinstalled Drupal. Fortunately, I'd done nothing so far with the site so I lost nothing.

vm’s picture

it's not an XAMPP specific task or doc. it would work for any environment. As an aside I found it fairly quickly with a google search specific to drupal.org

aniruddhsinh’s picture