Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send email with profile picture PHP mail function

I would like to show a profile picture in my users inbox when they receive an email sent from my website with PHP.

In this image the first email is from my website and the second one is what I want.

And here is my PHP mail function:

            $emailTo=$_POST['emialNewPass'];
            $emailSubject="Recovery";
            $emailLoctuz="[email protected]";
            $message="msg";

            $headers  = 'MIME-Version: 1.0' . "\r\n";
            $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
                            // En-têtes additionnels
            $headers .= 'To: '.$emailTo."\r\n";
            $headers .= 'From: Loctuz Security <'. $emailLoctuz . '>' ."\r\n";

            if(@mail($emailTo,$emailSubject,$message, $headers))
            {
                ?><script>window.location = "?sent";</script><?php                  
            }
like image 267
bdtry Avatar asked May 31 '26 17:05

bdtry


2 Answers

After research and testing I found:

  1. There is no "programmatic" way to affect the profile picture.
  2. The best way to apply a profile picture to Gmail recipients' inboxes is to create a Google+ account for the sending address and add a profile picture to it (more below)
  3. Other email services and inboxes (including Airmail, Sparrow, Postbox, and Thunderbird) use Gravatar (more below)
  4. I'm sure there are email services not touched by this...

Use Google+ to add profile pics to Gmail:

  1. Go to http://plus.google.com/
  2. If you are already logged in, log out
  3. Click "Use another account"
  4. Click "More options" -> "Create account"
  5. Enter first and last name
  6. Under Choose your username click "I prefer to use my current email address"
  7. Enter the email address you want to send from with a profile picture to the "Your email address" field
  8. Fill out the rest of the fields
  9. Once your account is created, click your profile in the top right, and click "Change: where your profile picture should be. Upload a profile picture
  10. Now wait for a day or two! It took almost 24 hours for my new Google+ profile picture to propagate to emails in my Gmail inbox. During this waiting period, I also deleted (and went to Trash->Delete forever) all emails from the address, and also removed it from my Gmail Contacts.
  11. After a day or so, I was able to send an email to myself from the address in question and see the profile picture I uploaded to Google+ in my Gmail inbox :)

Use Gravatar to add profile pics to other inboxes:

  1. Go to http://gravatar.com/
  2. Click Sign In and sign in if you are not already
  3. Add an email address - use the email address to want to send form with a profile picture
  4. Upload an image
like image 115
Matt Rabe Avatar answered Jun 02 '26 06:06

Matt Rabe


I don't believe that there is a way to add an avatar image to a MIME email

As far as Gmail goes. If you add an image to your Gmail profile, it will automatically be shown when another Gmail user gets an email from you, looks you up in their address book, or chats with you.

Assuming its not gmail then its read from the users address book or contacts. Neither of which you have access to edit.

like image 27
DaImTo Avatar answered Jun 02 '26 06:06

DaImTo