My code
$headers = 'MIME-Version: 1.0' . PHP_EOL;
$headers .= 'Content-type: text/html; charset=iso-8859-1' . PHP_EOL;
$headers .= 'From: Me <me@gmail.com>' . PHP_EOL;
imap_mail('you@gmail.com','test',"$output","$headers");
Is there a way to sign the mail? when I use above code to test sending emails, I receive the email but I am getting the error
This message may not have been sent by: me@gmail.com Learn more Report phishing
according to gmail they attach signed data to the headers to authenticate
I am using gmail imap to send the mails
$inbox = imap_open($hostname,$username,$password)
or die('Cannot connect to Gmail: ' . imap_last_error());
Is there a way to authenticate the email using php imap?
If you want to send mails as a Gmail user I recommend using the Gmail's SMTP. As IMAP is mainly used to receive mails from the inbox.
Here's how to send mails from Gmail's SMTP.
First
Then
Sending Mail from PHP Using SMTP Authentication - Example
Sending Mail from PHP Using SMTP Authentication and SSL Encryption - Example
Source about.com