• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

mail() is not working inn PHP script

 
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using following code with phpTest1.php script




When I execute this code, message is not getting sent to mymail_nirjari@yahoo.com and I get following message.

led to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\phpTest1.php on line 12


Why is that ? I dont unerstand this message.How can I use mail() in the script ?

Below is httpd.conf file
 
Ranch Hand
Posts: 71
PHP Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's examine the error messages:

connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini



PHP is attempting to connect to an email server on localhost (connect to mailserver at "localhost") using the standard email port (port 25).

So let me ask this: are you running an email server on your PC? I suspect that the answer is no.

The error message then gives you a hint as to what to do (verify your "SMTP" and "smtp_port" setting in php.ini).

So here is what you need to do. Find out, from your email provider, what their SMTP host name is and what port they use and then update your php.ini file to reflect that information. Since you are sending email to a yahoo address, I will assume that you are using yahoo as the email server. A search for yahoo smtp configuration yielded several results, such as this one: http://answers.yahoo.com/question/index?qid=20080814033844AA3xxOp

If you need more help, tell me which email provider you use. You should also look for the php.ini file (if you run the info.php file I suggested on your other post it will tell you where php.ini is located on your PC)
 
nirjari patel
Ranch Hand
Posts: 386
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am learning this PHP and I am using Bell Canada as my ISP. Will they provide SMTP host name ? when I was trying to setup outlook, I was asked similar question and if I use yahoo account they would charge me for that. But google account was free. So is this similar situation ? Can I use gmail account for this ?

Thanks
 
Nick Charles
Ranch Hand
Posts: 71
PHP Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If Bell Canada provided you with information to hook up Outlook, you can use that same information in the php.ini file to connect to them. Just look in Outlook under Account Settings for your account information.

And yes you can also connect to gmail. Here is the page on that info: http://support.google.com/mail/bin/answer.py?hl=en&answer=13287

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!