Hi
I want to use a external SMTP server with the mail function (under Win32) but i need to make an authentication (user and password) on the server when i call the mail function (or before). Anyone knows how ?
Desbaratizador
Printable View
Hi
I want to use a external SMTP server with the mail function (under Win32) but i need to make an authentication (user and password) on the server when i call the mail function (or before). Anyone knows how ?
Desbaratizador
Are you sure? The only thing I had to do was change the host from "localhost" to the IP of the SMTP server.
There aren't any authentication options in the php.ini file, so I assume any authentication would have to be done within PHP itself, and I'm sure the documentation on www.php.net is adequate.
PHP's mail function doesn't allow you to authenticate to the SMTP server. I've attached a copy of a mailing class which does allow authentication though. This is how you use it:Quote:
Originally Posted by Desbaratizador
PHP Code:$mailer = new mail_message;
$mailer->smtp_host = 'mail.host.com';
$mailer->smtp_user = 'username';
$mailer->smtp_pass = 'password';
$mailer->add_recipient('Jim Davis', '[email protected]');
$mailer->from('Webmaster', '[email protected]');
$mailer->subject = 'Test';
$mailer->body = 'This is a test message.'
if (! $mailer->send()) {
die($mailer->error);
}
Thanks