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 = "[EMAIL PROTECTED]";
        $recipient = "[EMAIL PROTECTED]";
        $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.


>>I 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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
Jim Musil
---------
Multimedia Programmer
Nettmedia
-------------
212-629-0004
[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to