I cannot for the life of me get mail to send properly using the mail() or pear::mail.
sendmail wouldn't work right so i gave up on the mail() command and switched to pear::mail. That works much better, it actually connects to postfix but this shows up in the logs:
Jun 10 13:05:58 shaun postfix/smtpd[30174]: connect from unknown[216.xxx.xxx.xxx]
Jun 10 13:05:58 shaun postfix/smtpd[30174]: NOQUEUE: reject: RCPT from unknown[216.xxx.xxx.xxx]: 550 <support@mydomain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<joe@domain.com> to=<support@mydomain.com> proto=ESMTP helo=<localhost>
Jun 10 13:05:58 shaun postfix/smtpd[30174]: lost connection after RCPT from unknown[216.xxx.xxx.xxx]
Jun 10 13:05:58 shaun postfix/smtpd[30174]: disconnect from unknown[216.xxx.xxx.xxx]
I don't know if this is really a php question since the php half works, just doesn't send and i don't know if it's the code or postfix. I can definetly say the mail server works fine i can send email from outlook, webmail, and others to support and it works. I don't understand how i'm getting a 550 error here though. The mail server and web server are on the same box, running FreeBSD 5.1, Apache 1.3.33, php4, and postfix with mysql virtual tables.
Any suggestions?
oh yeah the x's and mydomain stuff is for security....
Thanks,
Shaun Mickey
270net Technologies
Systems Administrator
Sending mail to postfix
Moderator: General Moderators
-
jammindice
- Forum Newbie
- Posts: 4
- Joined: Fri Jun 10, 2005 12:20 pm
- Location: MD, USA
-
jammindice
- Forum Newbie
- Posts: 4
- Joined: Fri Jun 10, 2005 12:20 pm
- Location: MD, USA
Well, yes i do run amavisd with clamav/spamassassin, but it's not a problem with either of them since it's a 550 user lookup error.
This is the code i'm using to send the email, it's like it's not sending it with the right "To:" address.
Code: Select all
require_once('Mail.php');
$recip = $_POSTї'recip'];
$headersї"e;From"e;] = $_POSTї'email'];
$headersї"e;To"e;] = $clientїcontact]їemail]ї$recip];
$headersї"e;Subject"e;] = $_POSTї'subject'];
$recipients = $clientїcontact]їemail]ї$recip];
$body = $_POSTї'msg'] . "e;<BR> Email: "e; . $headersї"e;From"e;];
function validate($the_email_address){
return (eregi ("e;^(їa-z0-9_]|\\-|\\.)+@((їa-z0-9_]|\\-)+\\.)+їa-z]+$"e;, $the_email_address));
}
if ($headersї"e;From"e;] == '' || !(validate($headersї"e;From"e;]))){
$headersї"e;From"e;] = 'info@mydomain.com';
}
if ($body == '' || $body == NULL || $body == 'Type your message here'){
echo "e;<h2>Your request could not be processed</h2><p>Please enter a valid message."e;;
} else {
echo "e;<H2>Your Request Was Sent Successfully</H2><p>Your request will be answered promptly."e;;
$paramsї"e;host"e;] = "e;mail.mydomain.com"e;;
$paramsї"e;port"e;] = "e;25"e;;
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("e;smtp"e;, $params);
$mail_object->send($recipients, $headers, $body);
}-
jammindice
- Forum Newbie
- Posts: 4
- Joined: Fri Jun 10, 2005 12:20 pm
- Location: MD, USA