phpmailer sent inline images as attachment - phpmailer

when I try to send emails with phpmailer, it send inline images as attachment. I mean before opening email for example in yahoo or gmail , they show that this email has attachment and when I open the mail, it shows images inline and in their right position with no problem,
but I see many emails with inline images that show emails as one that don't have any attachment.
by the way for embedding images to phpmailer I use this method: addEmbeddedImage(filename,cid)
what can I do to solve this problem?
thanks for you help

If you attach images to an email, they are attachments, no matter what. If you use them by referring to their cid values from within your HTML, they will render inline as well, but they will still be shown as attachments, because they are. If you refer to images using remote URLs, they will render inline as well (providing you allow your mail client to do so), and they will not show as attachments - that is what the other messages you're seeing will be doing. Generally speaking, referring to images remotely is preferable to embedding/attaching.

Related

AWS SES breaks an email styles

I have a bunch of emails which are written using MJML. The output HTML seems to be correct.
As an email sender, I'm using AWS SES. But after sending, all my CSS styles in an email are broken. To send an email, I'm using method ses.sendEmail.
I have tried to use CSS injected in HTML head and inline styles. Does not work.
What could be the problem with it? Thanks!
First, check your HTML. Send it through either of these free sites: https://www.putsmail.com (requires a free Litmus account; they're an established and reputable Email Service Provider, ESP) or https://useparcel.com/ (an editor for email HTML; put your HTML in the editor and use their free send feature). With putsmail, don't accept their offer to inline your CSS for you--that'll change your HTML.
When each email arrives, compare the HTML received to what you sent. Diff tools are helpful.
I just sent a 1300+ line HTML file through each of those. For both, every character arrived unchanged, except for blank lines after the </html>. That's okay with me!
Compare the rendering to what you see in one of the MJML rendering tools (maybe https://mjml.io/try-it-live or the MJML desktop app https://mjmlio.github.io/mjml-app/). Do not depend on the rendering in any one email client as fully representative of the HTML; most of them have quirks. (I'm lookin' at you, all Outlooks except Apple's! And GMail. And Yahoo!. More at https://caniemail.com/ .)
I did a little research on AWS ses.sendmail. There's important advice and information at both of these.
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-sendmail.html
https://docs.aws.amazon.com/ses/latest/APIReference/API_SendEmail.html
I found an SO ticket from a little less than a year ago that could be relevant.
AWS Amplify SES sendmail AccessDenied
Recommend you review all that. Maybe something there will improve your experience.
Last, some standard advice from the world of email HTML. If you get sendmail working, perhaps it doesn't apply.
Send your HTML using an ESP that doesn't change your HTML. For people sending lots of email, there are lots of good reasons for using an ESP. Many provide valuable services. By the same token, some ESPs change the HTML before sending; lots of us avoid them.
I hope you get it figured out. Email HTML is, as you're experiencing, anything but easy.

PHPMailer doesn't load HTML email with attachment on iPhone

I'm using PHPMailer to send an HTML email when someone requests a brochure from a website.
My issue is that when I send the email without the attachment the email opens and displays the HTML email correctly. As soon as I add the attachment it doesn't load the HTML email and just shows text. NB: I haven't uploaded any code as the email itself sends with or without the attachment, so didn't think you guys would need it.
So:
1) Email sends OK with or without the attachment
2) With the attachment, it arrives (with the attachment) but doesn't show HTML email
3) Without the attachment the HTML is displayed correctly.
This specifically relates to an iPhone and it asks me to download the remainder of the email.
I know this should work OK as I know a competitors website that uses the exact same process and their email loads perfect everytime!
Any help would be useful.

How to send attachment in slack bot using SlackClient for node.js

I want to send image, text and bullet point with different colours. I am only able to send back message using
slackClient.sendMessage(botSays(parsedResp, witError, message) , message.channel);
But I don't know how to send attachment. Any help will be appreciable
Thanks
I found the answer. Attachments can be sent to user via IncomingWebhook or Web Api. There are many html text formatting and image attachment also possible. Slack Attachment api

Data URI image embedded in html page to be view in email client

I have a html file (generated via knitr package in R). It has a image which is encoded as data uri so there is no need for image attachments. Here is the link to that sample.html
http://jsfiddle.net/ebwsozav/
Sending it as an attachment, hasnt been issue but now we want to send this html to be embedded into the content of the email.
Using mutt, mutt -e "set content_type=text/html" -- person#gmail.com < sample.html.
Upon opening the email, I realised that the image couldnt be seen, though the html tables and other content could be.
Screenshot attached here
I read that gmail blocks images.
Could this the reason and is there a way to circumvent this problem ?
Update
Outlook cant view it.
Gmail in Android not able to view.
But surprise,surprise
Gmail in iOS system is able to view the image.
I read that gmail blocks images.
Partially correct. Gmail filters data URIs from being displayed in its interfaces, but it allows you to download/forward the original message (including the data URI) to a mail client that doesn't filter it. It does block (all) images on messages flagged as spam.
is there a way to circumvent this problem ?
Not exactly. You have to either use a regular URL or attach the image. It is intended for there to be no way to use data URIs in their interface.

php mailer no pictures in gmail

in phpmailer I didn't see pictures in gmail, only if I press show images, same email sent from outlook (same text, same from, same smtp, same dkim, same x-mailer) it's OK.
Any ideas? I want phpmailer because i can rotate things in subject or from or bla bla.
Outlook inlines image data to avoid client connections to outer sources. Instead of using external links with html bodies, use attached images or inlined HTML binary data with appropriate mimes during creation of e-mail body.
Here is an example code:
<img src="data:image/jpeg;base64{binary_data_here}" />

Resources