NewPHPFreak Posted May 13, 2009 Share Posted May 13, 2009 Hi... I'm new to PHP and to Pear (and to phpfreaks). My environment is... Win XP, Apache 2.2, PHP 5.2.9-2, Pear 1.8.1, And, phpinfo() confirms that openssl is enabled. If I change the following code to use an SMTP server (mailhost.att.net) that does NOT require an SSL connection or authentication (with 'auth' => false and $port = "25"), it works just fine . But if I run the code as shown, to send mail to an SMTP server that requires a SSL connection with authentication (imailhost.worldnet.att.net), it does not work ???. I get no output at all from the script, and no mail gets sent. In previous attempts with similar code, I got an error in my browser that said the server was rejecting the connection. I'm using the same username, password, port, and SSL encryption in a mail client, and I have no trouble sending mail to the imailhost.worldnet.att.net server, so I'm pretty confident it's my script or something related to php or pear on my machine. One possible clue is that when I comment out the entire $smtp = Mail::factory() statement, I can get phpinfo() output to my browser, although, obviously, the message does not get sent to the SMTP server. FYI, att.net requires the use of SSL and authentication to use their mail servers if you are connecting to them thru another ISP. Here's the code I'm using... <html> <body> <?php phpinfo(); require_once "Mail.php"; $from = "Me <[email protected]>"; $to = "Them <[email protected]>"; $subject = "Hi!"; $body = "Hello World."; $host = "imailhost.worldnet.att.net"; $port = "465"; $username = "my.at&t.username"; $password = "mypassword"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?> </body> </html> Any assistance would be appreciated ! Link to comment https://forums.phpfreaks.com/topic/157990-cant-send-mail-using-ssl-encryption-pear/ Share on other sites More sharing options...
NewPHPFreak Posted May 13, 2009 Author Share Posted May 13, 2009 I made this change to my code, without any success... $host = "ssl://imailhost.worldnet.att.net"; Link to comment https://forums.phpfreaks.com/topic/157990-cant-send-mail-using-ssl-encryption-pear/#findComment-833417 Share on other sites More sharing options...
NewPHPFreak Posted May 15, 2009 Author Share Posted May 15, 2009 Aren't there any php / SSL / SMTP / PEAR gurus out there that might have a suggestion ? Anyone ? Link to comment https://forums.phpfreaks.com/topic/157990-cant-send-mail-using-ssl-encryption-pear/#findComment-834714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.