With php mail() I can write
mail(\'to@example.com\',\'subject!\',\'body\',\'From: from@example.com\',\'-f from@example.com\');
But how can
The -f flag is set with $email->Sender
This is the Envelope From which allows the email server to evaluate the sender's email address before receiving the rest of your email data
SetFrom - this is what email address the end user will see as the message coming from
AddReplyTo - this is what email address will pop up if they reply to the email
Sender needs to be clean to pass spam filters
SetFrom needs to be clean to pass spam filters
AddReplyTo doesn't really matter. This allows a service to send an email on behalf of a user with an email address not managed by the service.