tags:

views:

10019

answers:

3

My ISP account requires that I send a username & password for outbound SMTP mail.

How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (SMTP= ) and From: (sendmail_from= ).

+1  A: 

Use Mail::factory in the Mail PEAR package. Example.

William Keller
+2  A: 

I prefer the PHPMailer tool as it doesn't require PEAR. But either way, you have a misunderstanding: you don't want a PHP-server-wide setting for the SMTP user and password. This should be a per-app (or per-page) setting. If you want to use the same account across different PHP pages, add it to some kind of settings.php file.

Cowboy_X
+6  A: 

PHP mail() command does not support authentication. Your options:

1) PHPMailer

Download: http://sourceforge.net/projects/phpmailer

Tutorial: http://phpmailer.codeworxtech.com/index.php?pg=tutorial#2

2) PEAR

Download: http://pear.php.net/package/Mail

Tutorial: http://email.about.com/od/emailprogrammingtips/qt/et073006.htm

3) Custom functions

See various solutions in the notes section: http://php.net/manual/en/ref.mail.php

daremon