i cant send email using localhost, please help, im a newbie in drupal.
do i have to configure anything?

heres the error 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\xinapse\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.
* 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\xinapse\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.
* 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\xinapse\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.

Comments

Iumentum’s picture

You need to change the SMTP server in your php.ini

jeannea08’s picture

tnx, but where can i find the php.ini? and what modifications that i have to do? tnx...

Iumentum’s picture

This deppends on your installation of PHP.
Do you use XAMP or something like that?
Else just make a search on your system after php.ini
The changes you have to make can also deppend on a few things.
So you need to find a SMTP server you can use in your location or with your IP.

jeannea08’s picture

will the error occur if Im going to upload my site?i mean im not going to use local host anymore?

Iumentum’s picture

The error should not occur when you move the site to a web hotel.
They have there smtp set right i guess :)

prassanna’s picture

i cant send email using localhost, please help, im a newbie in drupal.
do i have to configure anything?

heres the error 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\xinapse\includes\mail.inc on line 193.

theamoeba’s picture

this is not really an issue, it just means that, because u are working on localhost, that you do not have an smtp server installed on ur pc. its not something to be worried about - when u install drupal on a live webserver (which will have an smtp server installed) you wont get an error anymore.

theamoeba
www.espresso-online.info

cyborg_0912’s picture

I am new to Drupal and I can't seem to get Drupal to Send mails.
I have also noticed that a lot of new comers have the same problem. I am working on a laptop and Appserv 2.5.9. I would also lke to be able to add a new user to see how my work is coming, and as you know i need to configure the mail to get the password.
I would be grateful if someone can please explain all about this topic so myself and other niños to Drupal can get it. Thanks a whole bunch.

CB0912

Iumentum’s picture

Can you send any emails at all from your web server using mail() ?
If not its most probably your smtp setting(server) within the php.ini file.

oneiropolos’s picture

I am experiencing the exact same "problem", which means that I cannot send e-mails in localhost. The thing is, how will I add users so that I can experiment with roles etc if I can't register anyone?

WorldFallz’s picture

You can add users without having email capability no problem-- just do it manually at admin/user/user/create.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

willow315’s picture

OK, I've listened to an entire page of how not to solve the problem.

I am running Drupal on a developement server. And exact duplicate of the production server I want to use in future. I have no "Host to set SMTP up for me. I need to know exactly what settings to use in php.ini. "Localhost" just refers to "this machine" If your mail server is set up on this machien, then you could use "localhost" as the mail server name. I'm thinking.

But, Anyway. I've tried setting it up to run it through Exchange Server or SMTP on the machine that's running Drupal.

I've used the IP address of the server, teh IP address of the Exchange server. localhost. everything. Nothing is working so I know I'm not configuring it correctly. Does anyone out there actually know what the correct configuration is? It is clear that I haven't got a clue.
Please, I am begging for some help.

Thanks, WCW wwright@wusf.org

WorldFallz’s picture

OK, I've listened to an entire page of how not to solve the problem.

Perhaps not for your particular situation, but then this thread wasn't started by you so it's likely to be a solution for a different situation.

Realize something-- problems sending email from localhost have absolutely nothing to do with drupal. It's completely a function of the os and app stack and there's probably 100 different ways to configure it that will depend entirely on the specifics of your exact situation so a one size fits all solution is virtually impossible.

Perhaps I took your opening statement the wrong way, but starting out with a complaint about how someone else's thread is "how not to solve the problem" is not only incorrect, but somewhat incendiary.

In any case, lets see if we can solve your problem. You don't mention which os you're using, but since you do mention exchange and iis we can assume it's some flavor of windows (even so, it's always best to specify exactly which os you're using).

Does anyone out there actually know what the correct configuration is?

There is no single 'correct' configuration. As I said above, it all depends on the configuration of your environment and you don't provide enough details to deduce the correct settings.

I use the following in my php.ini:

[mail function]
; For Win32 only.
SMTP = exchserver1.domain.net
smtp_port = 25
sendmail_from = username@domain.net

And it works fine. This assumes that the server name is the name of a valid server configured with smtp on port 25.

As for localhost, the setting is 'SMTP = localhost', but in order for it to work you'll still need a valid smtp server functioning on the system. Depending on the version of windows, i don't believe this is configured automatically.

A little googling located: PHP Sendmail Setup with SMTP IIS and Windows Servers which also explains how to test that email is working (which you need to verify before even trying it through your drupal site).

Also, another site useful for drupal/php with windows/iis is http://www.iis-aid.com.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

momo18’s picture

I'm trying to configure my development sandbox so I can test sending and receiving mails without having to host it on an external web server.

I am using XAMPP, and Drupal 6.9 on Windows while developing on my localhost machine, and I want to route mails through my ISP.

I have done some research and tried a variety of ways to configure but I haven't succeeded so far. All I want to do is to receive drupal confirmation emails that I have setup correctly. And have them sent either sent to my inbox being routed through my ISP, or saved in a directory where I can verify they were sent.

I tried configuring sendmail but I'm received a variety of error messages.

I set the php.ini configuration parameters as follows:

[mail function]
; For Win32 only.
SMTP = mail.netvision.net.il
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com
sendmail_from = admin@localhost

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

And I get the following error message back from Drupal, when for example I try to login and get Drupal to mail me back my password:

* 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\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.

What confuses matters even more is that there isn't just one php.ini file in the php directory, but a php4.ini, php5.ini etc., files as well, and I'm not sure which is the correct one.

I don't seem to be getting past Drupal.

Can someone please explain, in a few simple steps what I need to do so as I can send (and maybe receive mails as well) from/to my localhost machine?

Thanks in advance.

dman’s picture

This actually seems to be taking steps in the right direction.
Previous posts all seemed to miss the point that to send mail, you need to be talking to a configured mail server. Personal PCs are normally NOT set up as mail servers, so normally will NOT relay mail sent to localhost. You have to set up a mail server locally (a hassle, and really for computer administrators only) - or point at one that already works.

Anyway
Yes, there are multiple sample php.ini files in many distributions. Run a phpinfo diagnostic and it will tell you which one is really being used.
And if your mail settings changes are taking effect.

if SMTP = mail.netvision.net.il is really set right, it SHOULD be possible to use your external ISP mailserver like that, so you are probably close.
Note that sendmail_path says it's for Unix Only?

.dan.
if you are asking a question you think should be documented, please provide a link to the handbook where you think the answer should be found.
| http://www.coders.co.nz/ |

momo18’s picture

Thanks a million. Your phpinfo() suggestion pointed me in the right direction. I was using the wrong php.ini file, instead of the php.ini file which is actually being called that's found in the apache folder.

Here's what I changed:

[mail function]
; For Win32 only.
;SMTP = localhost
SMTP = mail.netvision.net.il
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com
sendmail_from = xyz@netvision.net.il

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = "\xampp\sendmail\sendmail.exe -t"
sendmail_path = "\xampp\sendmail\sendmail.exe -t"

Thanks again. It worked so far for me on Windows.

BTW, you can use the telnet mail.netvision.net.il 25 command, to confirm whether your ISP mail server address can be accessed on port 25, for example.

moses | http://www.itwrite.com | part-time drupal coding

jrogers@jrdesignsbyjoy.com’s picture

Even after I change the SMTP, the port, and the email in all of my php.ini files. I still get the:

* warning: mail() [function.mail]: SMTP server response: 553 Sorry, that domain isn't in my list of allowed rcpthosts. in C:\wamp\www\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.

Does anyone know what to change in the mail.inc file? I have gone through and gone through it and I can't seem to tell where to change the domain in it.

Thanks!

Joy

WorldFallz’s picture

What are you using for the smtp server? beware that many isps block port 25 to ostensibly prevent spam.

===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz

juan_g’s picture

I solved it, to send mail from my local Drupal test site, with a Drupal module (SMTP Authentication Support) configured to use an external SMTP server of my web host.

drewe20’s picture

First, are you connected to the internet?

Drupal 6 and beyond Drupal Tutotials

newb454’s picture

Hi all, I was in exactly the same position, suffering the "Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini ..." problem.
Others have kindly pointed out that this is not a drupal issue, just a question of needing a mailserver on your PC. With my drupal (acqui Damp stack) on my local machine, I wanted to experience the emails along with other drupal stuff. I read somewhere on a forum about argosoft freemailserver. I installed that on my XP64 and set it up (no start menu entry, so I had to find it on my c drive) to have my admin user and the password that I had set up on drupal, as well as a new user name and the password I was yet to set up on drupal. When I set up that new user on Drupal, I got an updated logfile in the argosoft window, so at least I could see it was doing something. Then I set up my outlook with my drupal admin and new user@localhost account on 127.0.0.1 and when I asked drupal for a new password for that user, I got drupal mails in my outlook! I was absolutely elated as I have struggled for ages to get this working and now I can really experience drupal properly. Hope that helps.

Bye.

stevedas’s picture

Thank you so much for your post on Drupal.org. I have installed the Argo soft mail server and I have the Drupal from DAMP installed. It should be simple but I'm still not sure how to use the Argo mail server with Drupal on my local machine. My Outlook is set up for my email address stevedas@nyc.rr.com (nyc.rr.com is my internet provider). When Argo is asking me for the "Domain name you will be receiving email using this server", I'm not sure what to enter. Then it asks me for username and password.

Then it asks me foe DNS server, "bounces from", and " "localhost"...I'm not sure what to enter for these either.

thanks so much in advance,

Steve

archimax’s picture

On my WindowsXP XAMPP localhost, using AT&T's smtp e-mail server, I had very good success with the 'SMTP Authentication Support' module, after a bit of wrestling with the e-mail address settings within my Drupal site. The install requires two simple downloads (see the SMTP module's install instructions included in the download) and a little configuration, but no edits are required in the php.ini unless you need the SSL encrypted connection. Then you just uncomment line 636: ;extension=php_openssl.dll by deleting the leading semicolon in the file /xampp/php/php.ini .

(Make sure you use the same valid e-mail address in the 'Administer-->Site configuration-->Site information -- E-mail address:' that you enter for the 'E-mail from address' in the SMTP Authentication Support module form. I received error 553 until I made these match.)

bharat83’s picture

I used the SMTP module with the gmail smtp server and wow, its working smoothly. If debugging is enabled you can actually see debug the problem with smtp if any.

juicytoo’s picture

Hi,

I use

[antix smtp server for developers]

on my windows machine.

It just pipes all email from the port 25 to a file.

Great for local testing.

That's really all you need.

Then when you deploy on the hosting server, smtp mail should be setup already.

cheers
Ed

yanyan729’s picture

juicytoo's recommendation to use Antix SMTP does work.

Its a tiny program that let's you view verification email when you created a new account.

This is great if you are testing your website in your local machine and wanted to view it like an end-user would see.

thanks for the tip juicytoo.

BTW, Antix SMTP installation is quick and easy.

When you open Antix SMTP you will see this window:

http://i42.tinypic.com/1zvvggi.jpg

And once the verification email has been sent you will see a text file (open w/ notepad):

http://i39.tinypic.com/5nm5id.jpg

and that's it.

p.s. I am running win7 64-bit, Drupal 6.16 and WampServer Version 2.0

Mars2012’s picture

Thanks for the great tip.

The antix smtp mail server for windows was an easy and nice instalation and works 100%.

Regards

daniel.25’s picture

After hassling with the set up of a local mail server on my local machine using hMailServer I used the Antix solution and it works just great . Thank you very much

drupalshrek’s picture

I too had this need to be able to send emails from my local PC (i.e. localhost), so I read all these different threads to find out how to do it. The solution which worked for me actually is incredibly easy (it's a simple one line change), but because everybody's PC and way they work is different I know it's not easy at all to follow, but I will describe what worked for me, and hope this helps someone!

Basically:
1) I went to my Microsoft Outlook and found out the value of SMTP that uses, which was "relay.skynet.be"
2) I changed my PHP.ini file to have "SMTP = relay.skynet.be" instead of "SMTP = localhost"

I restarted my server, and that was it!! It's so amazingly simple!

I'll try and describe each of the above steps in more detail.

Firstly, I am running:

  • Windows Vista
  • Microsoft Office Outlook 2003
  • Zend Server Community Edition 5.6
  • Apache

You're setup may of course differ, so you may have to hunt around a bit to find exactly how to do the same thing on your PC. Google is your friend there!

OK, step 1:
1) I went to my Microsoft Outlook and found out the value of SMTP that uses, which was "relay.skynet.be":
* Select "Tools --> E-mail accounts --> View or change existing accounts
I then had an "Email accounts screen" listing my account names (only 1) of type POP/SMTP listed.
I clicked "Change" against this account and I got to the "Internet E-mail settings (POP3)" screen.
Here, I copy down the value next to "Outgoing mail server (SMTP)", which in my case was "relay.skynet.be", but this is where your value will be different.

Step 1 now complete.
You should also be able to ask your ISP what that value is for you, but that would no doubt be a hassle.
The following link has some more suggestions:
http://www.fairlogic.com/worldcast/manual/framesmall/what'smysmtpserver.htm

OK, step 2:
2) I changed my PHP.ini file to have "SMTP = relay.skynet.be" instead of "SMTP = localhost"
There are many ways to find out where your PHP.ini file is but this is the one I used:
* I opened up Zend Server which for me was at:
** http://localhost:10081/ZendServer/
* On the default page ("Monitor --> Dashboard" tab), there is a link "View PHPinfo page", which I click
* I search for "SMTP" which I see, true enough, is set to "localhost". OK, that's what to change!
* I go back to the top of this page to see where it is getting the PHP.ini file from. Near the top it has the page, in the field "Loaded Configuration File" so you could search for that.
* Then I went with a text editor to that file and changed the SMTP line, i.e.
** "SMTP = relay.skynet.be" instead of "SMTP = localhost" with the value I found earlier
* All that was left now was to restart PHP, which I did by going back to the Zend Server page and clicking "Restart PHP" which was in the bottom right corner of:
** http://localhost:10081/ZendServer/
* I again checked via the Zend Server page to see if the SMTP line had changed by searching for SMTP and both columns next to SMTP had "relay.skynet.be" in them.

Finally, I retried my Drupal code (I was testing the email notifications of when a chess move is made for the VChess module). No error message now at least. But did it work?! A few minutes later, my gmail inbox had received an email! Hooray!!!!

Hope that helps someone.

drupalshrek

Robin Kumar Tonk’s picture

Yes https://www.drupal.org/project/smtp great module to setup email sending to the drupal site, its works fine

mayur.pimple’s picture

install but not working in localhost. i have install with mailgun server. but not showing error

ravipatel181229’s picture