Vebut Posted December 14, 2009 Share Posted December 14, 2009 I'm currently working on a newsletter application which is installed on a windows 2003 server running apache. This server is scheduled to run a script every 5 minutes that will send an email to 10 individuals during each iteration. It all works fine when sending to emails registered with our mail server but when sending to external addresses I get a 550 error from the smtp. I've setup these settings in php.ini: smtp = mail.*public_domain*.se smtp_port = **** username = *noreply email account* password = ******* sendmail_from = *same as username* Is there something obvious i'm missing here? Thanks! Edit: Not IIS, its apache Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 14, 2009 Share Posted December 14, 2009 It all really depends on your server configuration.. I had a host once that did not allow sending mail using PHP mail. Have you looked into using PEAR::Mail that allows use of SMTP authentication? Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 authenticate ur mail using this one <?php require_once "Mail.php"; $from = "Chaitu <drvirusindia@gmail.com>"; $to = "Chaitu <drvirusindia@gmail.com>"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; $host = "ssl://mail.example.com"; $port = "465"; $username = "smtp_username"; $password = "smtp_password"; $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>"); } ?> might be it will help u out. just check whether PEAR installed in ur machine Quote Link to comment Share on other sites More sharing options...
Vebut Posted December 14, 2009 Author Share Posted December 14, 2009 I installed pear (go-pear.bat) and then installed the mail package using command line: "pear install mail" but when I try to use the Mail class inside of my application it can not locate the class. SPL should load it right? Quote Link to comment Share on other sites More sharing options...
Buddski Posted December 14, 2009 Share Posted December 14, 2009 FYI: Ensure that the PEAR directory is included in your include path Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 just check these artilces which can help u out http://www.cyberciti.biz/tips/rhel-install-php-net-smtp-email-socket.html http://pear.php.net/manual/en/guide.users.commandline.installing.php also when u open php.ini it should have this line uncommented. include_path = ".;C:\xampp\php\PEAR" Quote Link to comment Share on other sites More sharing options...
Vebut Posted December 14, 2009 Author Share Posted December 14, 2009 Ok, now I've got the Mail class working but when using factory I get a fatal error: Fatal error: Class 'Net_SMTP' not found in D:\wamp\bin\php\php5.2.11\PEAR\Mail\smtp.php on line 210 Edit: Never mind, I installed the Net_SMTP package as well and now its working just fine. Thanks for all the help! Quote Link to comment Share on other sites More sharing options...
Deoctor Posted December 14, 2009 Share Posted December 14, 2009 open ur smtp.php file and change the values class Mail_smtp extends Mail { /** * SMTP connection object. * * @var object * @access private */ var $_smtp = null; /** * The SMTP host to connect to. * @var string */ var $host = 'localhost'; /** * The port the SMTP server is on. * @var integer */ var $port = 25; /** * Should SMTP authentication be used? * * This value may be set to true, false or the name of a specific * authentication method. * * If the value is set to true, the Net_SMTP package will attempt to use * the best authentication method advertised by the remote SMTP server. * * @var mixed */ var $auth = false; /** * The username to use if the SMTP server requires authentication. * @var string */ var $username = ''; /** * The password to use if the SMTP server requires authentication. * @var string */ var $password = ''; /** * Hostname or domain that will be sent to the remote SMTP server in the * HELO / EHLO message. * * @var string */ var $localhost = 'localhost'; /** * SMTP connection timeout value. NULL indicates no timeout. * * @var integer */ var $timeout = null; /** * Whether to use VERP or not. If not a boolean, the string value * will be used as the VERP separators. * * @var mixed boolean or string */ var $verp = false; /** * Turn on Net_SMTP debugging? * * @var boolean $debug */ var $debug = false; /** * Indicates whether or not the SMTP connection should persist over * multiple calls to the send() method. * * @var boolean */ var $persist = false; indicated to the smtp server which u are using. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.