问题
I'm constructing HTML emails in PHP with Zend_Mail and I'd like to embed/attach/whatever some images in such a way that Gmail will automatically display them without prompting the user. How can I do this?
回答1:
Google's Bulk Sender Guidelines say that Gmail will automatically show images for senders who have authenticated their domain:
To ensure that Gmail can identify you:
- Use a consistent IP address to send bulk mail.
- Keep valid reverse DNS records for the IP address(es) from which you send mail, pointing to your domain.
- Use the same address in the 'From:' header on every bulk mail you send.
We also recommend publishing an SPF record, and signing with DKIM or DomainKeys.
By authenticating, inline images you send will be shown automatically. Recipients will not need to click the "Display images below" link.
Google offers a page to learn more about email authentication.
回答2:
You can't without the user approving your imagery. It's an anti-spam/ anti-tracking technique that has to be off by default to work.
You can make Gmail display images (embedded into content) with authenticating emails sent. You just make sure you have a correct SPF record, and 1024 bit DKIM signed the message. Then gmail shows embedded images within content.
回答3:
As of my knowledge, This is not possible. Gmaill will hide the images initially. If the Use enables (by clicking "Always display images from XXXXXX website
"), then it will be available from next time onwards
回答4:
You can always show images if you use Base 64. That way images are embedded as code in the code and aren't coming from anyone else's server, so there is no tracking risk. Just google how to embed an image as Base 64 and that will solve your issue completely.
来源:https://stackoverflow.com/questions/11728504/make-gmail-automatically-show-images-i-embed-in-my-html-email