Skip to content
Advertisement

From which email address will php send in mail() function

I am making an email form but from which email address is the mail sent?

Thanks!

Advertisement

Answer

from whatever email adress you specify as sender:

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )

for headers, you can add:

$additional_headers.= "From: foo@bar.com";    

But help yourself and use PHPMailer along with a well configured, dedicated SMTP-Server to send mails: https://github.com/PHPMailer/PHPMailer

(You’ll run into lot of issues otherwhise)

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement