PDA

Click to See Complete Forum and Search --> : Mail server authentication


Desbaratizador
Jan 24th, 2005, 06:37 AM
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

ober0330
Jan 24th, 2005, 08:40 AM
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.

visualAd
Jan 25th, 2005, 04:14 AM
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 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:

$mailer = new mail_message;

$mailer->smtp_host = 'mail.host.com';
$mailer->smtp_user = 'username';
$mailer->smtp_pass = 'password';

$mailer->add_recipient('Jim Davis', 'jdavis@hotmail.com');
$mailer->from('Webmaster', 'webmaster@hotmail.com');

$mailer->subject = 'Test';
$mailer->body = 'This is a test message.'

if (! $mailer->send()) {
die($mailer->error);
}

Desbaratizador
Jan 25th, 2005, 10:30 AM
Thanks