Jump to content

smtp inline image - gmail problems


Go to solution Solved by Destramic,

Recommended Posts

hey guys i'm having problems with gmail showing inline images when sending a email from my server...for some strange reason it shows as an attachment, but works prefectly for hotmail.

 

here is what i'm getting..

 

 

hotmail

 

c1af0b2825.gif

 

 

gmail

 

c1abf519f4.gif

 

i can't find nothing obvious about inline image problems with gmail so i wondered if any of you guys have come across this problem and what i could do to solve it.

 

 

here is my headers and boundarys set for the email...

Content-Type: multipart/related; boundary="e3b811c438657c9d0f9ae45330038d29"
This is a multi-part message in MIME format.
--e3b811c438657c9d0f9ae45330038d29

Content-Type: multipart/alternative; boundary="23d529da6bbc0c660362bf9a39c6b994" 
--23d529da6bbc0c660362bf9a39c6b994

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Transfer-Encoding: 7bit

plain email here

--23d529da6bbc0c660362bf9a39c6b994
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Transfer-Encoding: 7bit

<!DOCTYPE html>
<head>
<title>Account</title>
</head>
<body>
<span>here
 is our logo</span>
<img src="cid:logo" width="192" title="Logo" alt="Logo">            
</body>
</html>

--23d529da6bbc0c660362bf9a39c6b994-- 
Content-Type: image/png; name="logo8.png"
Content-Transfer-Encoding: base64
Content-ID: <logo> 
X-Attachment-Id: logo
Content-Disposition: inline; filename="logo8.png"

iVBORw0KGgoAAAANSUhEUgAAArUAA...AgFQ9AAAAUvUAAABI1QMAACD1AZpW uZb0vX7fAAAAAElFTkSuQmCC 

--e3b811c438657c9d0f9ae45330038d29--

any help would be great,,,thank you

Edited by Destramic
Link to comment
https://forums.phpfreaks.com/topic/302855-smtp-inline-image-gmail-problems/
Share on other sites

sorry i couldn't edit the message above here is the correct headers etc from my debug array

    [17] => Content-Type: multipart/related; boundary="60a7083d603d0f8a9d35a0776030d8e5"
    [18] => This is a multi-part message in MIME format.
    [19] => --60a7083d603d0f8a9d35a0776030d8e5
    [20] => Content-Type: multipart/alternative; boundary="acabb8838a7d2b2a9ec0661d699c96bc"
    [21] => --acabb8838a7d2b2a9ec0661d699c96bc
    [22] => Content-Type: text/plain; charset="utf-8"
    [23] => Content-Transfer-Encoding: quoted-printable
    [24] => Content-Transfer-Encoding: 7bit

    [25] => plain email here
    [26] => --acabb8838a7d2b2a9ec0661d699c96bc
    [27] => Content-Type: text/html; charset="utf-8"
    [28] => Content-Transfer-Encoding: quoted-printable
    [29] => Content-Transfer-Encoding: 7bit

    [30] => <!DOCTYPE html>
<head>
<title>Account</title>
</head>
<body>
<span>here
 is our logo</span>
<img src="cid:logo" width="192" title="Logo" alt="Logo"
>            
</body>
</html>

    [31] => --acabb8838a7d2b2a9ec0661d699c96bc--

    [32] => --60a7083d603d0f8a9d35a0776030d8e5
    [33] => Content-Type: image/png; name="logo8.png"
    [34] => Content-Transfer-Encoding: base64
    [35] => Content-ID: <logo>
    [36] => X-Attachment-Id: logo
    [37] => Content-Disposition: inline; filename="logo8.png"

    [38] => iVBORw0KGgoAAAANSUhEUgAAArUAAAC7CAYAAAB7NWYYAAAACXBIWXMAAAsSAAALEgHS3X78AAA.....Zb0vX7fAAAAAElFTkSuQmCC

    [39] => --60a7083d603d0f8a9d35a0776030d8e5--
    [40] => Array
        (
            [command] => .
            [response] => 250 Queued (0.192 seconds)

        )

According to the specification the content-id is supposed to follow the addr-spec format which is defined as addr-spec = local-part "@" domain. Examples I can find in my email seem to follow that pattern, so I'd suggest you try the same.

According to the specification the content-id is supposed to follow the addr-spec format which is defined as addr-spec = local-part "@" domain. Examples I can find in my email seem to follow that pattern, so I'd suggest you try the same.

 

i tried what you said kicken and still have no joy...i also tried cid:logo@mydomain.co.uk

 

here is my altered code

 [7] => SUBJECT: test email
    [8] => FROM: mydomain.co.uk<****>
    [9] => TO: *****
    [10] => MIME-Version: 1.0
    [11] => Organization: mydomain.co.uk
    [12] => X-Priority: 3
    [13] => X-Mailer: PHP7.0.10
    [14] => Message-ID: <6af3b38673bc078a1bf662e27843477b@mydomain.co.uk>
    [15] => Date: Wed, 04 Jan 2017 17:39:27 +0000
    [16] => Return-Path: ****@mydomain.co.uk
    [17] => Content-Type: multipart/related; boundary="f81c1c99aa6cb085a26b84813c0a2fd6"
    [18] => This is a multi-part message in MIME format.
    [19] => --f81c1c99aa6cb085a26b84813c0a2fd6
    [20] => Content-Type: multipart/alternative; boundary="1f04e7b81c18373984b26f1e64f9b83e"
    [21] => --1f04e7b81c18373984b26f1e64f9b83e
    [22] => Content-Type: text/plain; charset="utf-8"
    [23] => Content-Transfer-Encoding: quoted-printable
    [24] => Content-Transfer-Encoding: 7bit

    [25] => plain email here
    [26] => --1f04e7b81c18373984b26f1e64f9b83e
    [27] => Content-Type: text/html; charset="utf-8"
    [28] => Content-Transfer-Encoding: quoted-printable
    [29] => Content-Transfer-Encoding: 7bit

    [30] => <!DOCTYPE html>
<head>
<title>Account</title>
</head>
<body>
<span>here
 is our logo</span>
<img src="cid:logo.png@mydomain.co.uk" width="192" heigh
t="50" title="Logo" alt="Logo">            
</body>
</html>

    [31] => --1f04e7b81c18373984b26f1e64f9b83e--

    [32] => --f81c1c99aa6cb085a26b84813c0a2fd6
    [33] => Content-Type: image/png; name="logo8.png"
    [34] => Content-Transfer-Encoding: base64
    [35] => Content-ID: <logo.png@mydomain.co.uk>
    [36] => X-Attachment-Id: logo.png@mydoamin.co.uk
    [37] => Content-Disposition: inline; filename="logo8.png"

    [38] => iVBORw0KGgoA....gABI1QMAACD1AZpW


    [39] => --f81c1c99aa6cb085a26b84813c0a2fd6--

any other suggestion would be great...i've looked a so much regarding embedded inline images and i can't see nothing else that i may be missing...i'm feeling there's something else that needs to be added to my headers though.

 

i even sent myself an email from my gmail account with an embedded image and tried to cross reference but all formats i saved we're barely readable.

 

thank you

  • Solution

i had a brain storm last night and sent the email via phpmailer and viewed what was actually being sent to the server...this format works perfectly now for alternative mail with embedded images.

Content-Type: multipart/alternative; boundary="fae15ab6820aee7cab838cf3b8f5ef37"
Content-Transfer-Encoding: 8bit

This is a multi-part message in MIME format.
--fae15ab6820aee7cab838cf3b8f5ef37
 Content-Type: text/plain; charset="utf-8"

plain email here
--fae15ab6820aee7cab838cf3b8f5ef37
Content-Type: multipart/related; boundary="aaf2651d4917027cd4c6a335082910a5"
--aaf2651d4917027cd4c6a335082910a5
Content-Type: text/html; charset="utf-8"

Sever: <span>here is our logo</span>
<img src="cid:logo.png@domain.co.uk" width="
192" height="50" title="Logo" alt="Logo">            

--aaf2651d4917027cd4c6a335082910a5
Content-Type: image/png; name="logo8.png"
Content-Transfer-Encoding: base64
Content-ID: <logo.png@domain.co.uk>
Content-Disposition: inline; name="logo8.png"

iVBORw0KGgoAAAANSUhEU.........b0vX7fAAAAAElFTkSuQmCC

 --aaf2651d4917027cd4c6a335082910a5--
--fae15ab6820aee7cab838cf3b8f5ef37--

i hope this can help other people out...thank you

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.