5

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="noreply@loctuz.com";
            $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                  
            }
BorisD
  • 1,611
  • 17
  • 22
bdtry
  • 69
  • 1
  • 1
  • 4

3 Answers3

3

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
Matt Rabe
  • 1,753
  • 19
  • 27
0

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.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • So I need to create an account for "noreply@site.com" :D thank you – bdtry Mar 29 '17 at 11:57
  • Yeah but it may only work if the user has you in their address book. I have never gotten it to work with all email accounts. – Linda Lawton - DaImTo Mar 29 '17 at 12:01
  • 1
    Next best thing to having an image in their address book is having a [gravatar](http://en.gravatar.com) for the address. They are used in lots of places. – Synchro Mar 29 '17 at 12:21
-3

I believe what you try to accomplish has nothing to do with PHP for mail sending, but rather code for displaying your website favicon. Here is a good read about them: https://css-tricks.com/favicon-quiz/

Abrucius
  • 101
  • 6