sending email using PHP email script

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
manishrathi
Forum Newbie
Posts: 6
Joined: Mon May 14, 2012 5:16 pm

sending email using PHP email script

Post 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
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: sending email using PHP email script

Post 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
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: sending email using PHP email script

Post 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.
(#10850)
Post Reply