문제

I have Plesk with a Network Solutions virtual server. When my site sends out emails using PHP, the email header indicates that the message is coming from an address like this one:

anonymous@002a1c9.netsolvps.com

How do I change this address?

도움이 되었습니까?

해결책

Using the PHP mail() command, you can set the envelope from address using the -f command, and you can include the from address in the message headers as well, like so:

    $to = "to@to.com";
    $from = "from@from.com";
    $subject = "subject";
    $message = "this is the message body";

    $headers = "From: $from"; 
    $ok = @mail($to, $subject, $message, $headers, "-f " . $from);   
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top