Thanks for this information. I was having problems with the mail() function then I saw this message and used the code and it worked. One thing I'm still trying to do though is to email multiple addresses in a single call and to add a CC address to mail().
I've tried passing more than one email address by concatenating commas and semi colons between addresses. That did not seem to work. I'm passing CC email address via $ccemail variable (below). This did not seem to work as well.
// Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port);
if($handle)
{
fputs($handle, "EHLO $mydomain\r\n");
// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
fputs($handle, base64_encode($username)."\r\n");
fputs($handle, base64_encode($password)."\r\n");
// Send out the e-mail
fputs($handle, "MAIL FROM:<$sender>\r\n");
fputs($handle, "RCPT TO:<$recipient>\r\n");
fputs($handle, "DATA\r\n");
fputs($handle, "To: $recipient\r\n");
fputs($handle, "CC: $ccemail\r\n");
fputs($handle, "Subject: $subject\r\n");
fputs($handle, "$content");
fputs($handle, "\r\n.\r\n");
Latest Update...
I got this to work now by passing mulitple recipients eg.
fputs($handle, "RCPT TO:<$recipient1>\r\n");
fputs($handle, "RCPT TO:<$recipient2>\r\n");
fputs($handle, "DATA\r\n");
fputs($handle, "To: $recipient1\r\n");
fputs($handle, "To: $recipient2\r\n");
Is there anyway to use Exchange without Authentication?