Re: URGENT-HELP !!!!!!
| From: | Jim Musil | Date: | Fri, 30 Nov 2001 14:59:06 +0000 |
| Subject: | Re: URGENT-HELP !!!!!! | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-76208@lists.php.net to get a copy of this message | ||
If you mail via pfsockopen, then you specify the sender which must be real, but you also specify the From: header which can be anything you want.
ex:
$smtp_server = "your.smtp.server";
$port = 25;
$mydomain = "yourdomain.com";
$sender = "foo@yourdomain.com";
$recipient = "bar@bar.com";
$subject = "Test";
$text_content = "Hi Bar, This is a test.";
$handle = fsockopen("$smtp_server","$port");
fputs($handle, "HELO $mydomain\n");
fputs($handle, "MAIL FROM: $sender \n");
$echo .= fgets($handle,255)."\n";
fputs($handle, "RCPT TO: $recipient \n");
$echo .= fgets($handle,255)."\n";
fputs($handle, "DATA\n");
$echo .= fgets($handle,255)."\n";
fputs($handle, "To: $recipient\n");
/* NOTE THAT HERE YOU SET WHAT APPEARS IN THE FROM: PART */
fputs($handle, "From: \n");
fputs($handle, "Subject: $email_subject\n");
fputs($handle, "Content-Type: text/plain; \n");
fputs($handle, $text_content."\n\n");
fputs($handle, ".\n");
$echo .= fgets($handle,255)."\n";
fputs($handle, "QUIT\n");
$echo .= fgets($handle,255)."\n";
echo "$echo";
Works here, but results may vary.
-- Jim Musil --------- Multimedia Programmer Nettmedia ------------- 212-629-0004 jim@nettmedia.comI am talking about the final SMTP host.. it will do a reverse lookup on the From: domain and if it dont resolve to the IP of the sending STMP host it will reject it.yes I know. But it the final SMTP tries to resolve the host (localhost) it will get a response from it self? I haven't tried it, but I think it would work. By the way... the most of the SMTP doesn't check at the FROM header, but from the sender SMTP. So if you got a nonexisting e-mail it would accept it too, but it the sender host isn't valid it will reject it. Regards, Johan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net