php PEAR smtp

I have managed to get my PHP email application working with the PEAR installation on my small business server 2003.
Problem is that it will not work on another server even though all the settings appear correct
The data is not being sent.
Can someone please tell me where on earth the SMTP values are being taken from in the PEAR application (Mail.php)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

check php.ini, usually found at the installation path of PHP or in c:\windows

if you can't find it make a php script with:


which will give u a diagnostic page with all of the loaded modules, their settings (including the SMTP settings), aswell as the location of php.ini so you can change this value.
also u can specify a smtp server in the script itself and pear will connect to it

    $from_name = "Zach Shaver"); 
    $to_name = "Experts Exchange User"); 

    $From = "From: ".$from_name." <>"; 
    $To = "To: ".$to_name." <>"; 

    $recipients = ""; 
    $headers["From"] = $From; 
    $headers["To"] = $To; 
    $headers["Subject"] = $subject; 
    $headers["Reply-To"] = ""; 
    $headers["Content-Type"] = "text/plain"; 
    $headers["Return-path"] = ""; 
    $smtpinfo["host"] = ""; 
    $smtpinfo["port"] = "25"; 
    $smtpinfo["auth"] = true; 
    $smtpinfo["username"] = "smtp_user"; 
    $smtpinfo["password"] = "smtp_password"; 

    $mail_object =& Mail::factory("smtp", $smtpinfo); 

    $mail_object->send($recipients, $headers, $mailmsg); 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
doctorbillTechAuthor Commented:
So the PEAR mail.php takes smtp settings from the php.ini file ?
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

doctorbillTechAuthor Commented:
I tried this with my own authsmtp settings:

$smtpinfo["host"] = "";
    $smtpinfo["port"] = "25";
    $smtpinfo["auth"] = true;
    $smtpinfo["username"] = "smtp_user";
    $smtpinfo["password"] = "smtp_password";

still not working.
Hi doctorhill,

PHP will do its best to figure out the mail host on its own, although it will read the "SMTP" setting from your ini file if you're running on Windows. That said, if you tried to specify the SMTP server manually and it still didn't work, then that makes me wonder if your script is running on a computer that is using a typical residential or cheap business internet connection. A lot of internet providers try to block any outbound email requests that are not routed through their own mail servers. For example, Cox Cable will block any communications on port 25 except for those going to their own SMTP servers (like

The reason for this is because of all those viruses about 5-10 years ago that were spreading by emailing themselves out directly to people. So by blocking all mail unless it goes through their own mail servers, internet providers can render those worms/viruses useless and can prevent newly-infected computers from spreading them further (and also limit the misuse/abuse of their own bandwidth).

The downside to this is that a provider can't distinguish between a worm trying to email itself out and a PHP script that is trying to connect to a valid, external mail server for a legitimate reason, so everything gets blocked. If your script is going to stay hosted on that network connection, try changing your SMTP host to whatever you use for your personal email on that internet connection (and don't use auth unless you also use it for your personal email).
doctorbillTechAuthor Commented:
I have tried using my "authsmtp" account which is usually  allowed from any network. The email is still not being sent
doctorbillTechAuthor Commented:
Certainly helped me to go forward
see if you can connect through telnet to the SMTP server from the remote machine

telnet 25

if the screen stays blank or if telnet won't connect, it's a connectivity issue, not an authentication issue.
similarly, you can install a mail client on the "remote" machine...
and verify you can send email from the mail client...

don't stress over doing it in PHP until you verify it's actually working as intended.
you already accepted my solution but i figured i'd give u those tips anyways lol
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.