Sending SMTP auth information via PHP?
| From: | J J | Date: | Tue, 08 Apr 2003 14:04:10 +0000 |
| Subject: | Sending SMTP auth information via PHP? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142865@lists.php.net to get a copy of this message | ||
I'm working on a mail script that talks direct to SMTP
instead of using mail(), but my SMTP server requires
authentication. How can I pass AUTH information to
the server via PHP?
Here's the code I have now:
function open($smtpserver,$ti=2){
$this->fp = fsockopen($smtpserver, 25, $errno,
$errstr, $ti);
if (!$this->fp){
echo "<b>Error opening $smtpserver</b><br><font
color=\"red\">$errstr ($errno).</font><hr>\n";
exit;
}
$this->recv();
}
Should I pass it somewhere in the fsockopen?
Later on I have this code to send the mail:
$mySTMPprocess->send("HELO mail.server.com");
$mySTMPprocess->send("MAIL FROM:$from");
$mySTMPprocess->send("RCPT TO:$email");
$mySTMPprocess->send("DATA");
$mySTMPprocess->send($theEmailText);
$mySTMPprocess->send("RSET");
$mySTMPprocess->send("QUIT");
Do I need to pass it at the time of sending?
The mail works great until I try to send to addresses
outside of the domain.
Thanks in advance!
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com