Page 1 of 1

sending email using PHP email script

Posted: Mon May 14, 2012 5:20 pm
by manishrathi
When I am sending an email from my yahoo, gmail or hotmail account, it is sent.

Now I have written a PHP (I am learning php), which sends an email from my yahoo account. When I run this script, instead of sending email I am getting an error.

Why am I getting such an error. What is the difference between sending email through script and from yahoo account ?

What I mean is, when I send an email from yahoo account, I am sending an email using browser only. At this time mail server is not required. But hen I send an email from mail program mail server is required. Like browser, can not mail program send mails ? A browser can connect with yahoo server and mail program can not ? Why ? what does browser have that can connect with yahoo server ? browser is using HTTP to connect with server. Can not mail program use HTTP ? Is it only browser which can use HTTP ? Does browser use SMTP or not ? Does mail program automatically use SMTP ?

Please provide answer in non technical terms and in some details please.

Thanks

Re: sending email using PHP email script

Posted: Mon May 14, 2012 6:08 pm
by twinedev
Well, for a better answer, what error are you getting? (ex, is it simply a syntax error in php, configuration, or authentication).

Can you post the code you are using, make sure you wrap it with [ syntax = php ] [ /syntax ] (no spaces inside the brackets) and replace your actual login credentials with ****'s

-Greg

Re: sending email using PHP email script

Posted: Mon May 14, 2012 10:34 pm
by Christopher
manishrathi wrote:What is the difference between sending email through script and from yahoo account ?

What I mean is, when I send an email from yahoo account, I am sending an email using browser only. At this time mail server is not required. But hen I send an email from mail program mail server is required. Like browser, can not mail program send mails ? A browser can connect with yahoo server and mail program can not ? Why ? what does browser have that can connect with yahoo server ? browser is using HTTP to connect with server. Can not mail program use HTTP ? Is it only browser which can use HTTP ? Does browser use SMTP or not ? Does mail program automatically use SMTP ?s
Sending mail requires a SMTP server. For your Yahoo account, the Yahoo web server talks to the Yahoo SMTP server. You browser does not send the email -- the Yahoo SMTP server does.

Your script is the same. It needs to connect to a SMTP server somewhere. Usually on localhost, but it could be some other accessible server. That is probably where the error is occurring.