Issues sending an email with an image in the body
See original GitHub issueHello,
I want to send an email with an image in the body. I can’t seem to find any documentation on how to accomplish this. If there is any documentation where would I find it? I tried sending both the file itself from where it is stored on my computer in the email and in a base64 format, neither have worked.
Any direction would be greatly appreciated .
Thank you!
Here is my code
function congratulationsTemplate(message){
// This line grabs the image I have stored in an uploads folder inside my directory
// This approach isn't working and I tried sending it in a base64 format and that isn't working either.
var image = path.join(__dirname, "../uploads/"+message.file).toString();
var data ={
from:'',
to:'',
subject: message.title,
html: "<h1>Hello World</h1><p>Here is an image:<br/> <img src='+image+'/></p>",
attachment: image
};
mailgun.messages().send(data, function (error, body) {
if(error) throw error;
console.log("Message Sent!");
});
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
Attach files or insert pictures in Outlook email messages
It's easy to attach pictures, files, contacts, emails and many other items to your Outlook messages. Outlook keeps track of the documents you've...
Read more >Turn images on or off in Gmail - Android - Google Support
By default, when you get an email with an image, you'll see the image automatically. Always show images If images don't load in...
Read more >Images not displaying in an email client
Apple Mail on iPhone/iPad; Gmail on Desktop, Android, and iPhone/iPad; Outlook (Outlook for Microsoft 365, Outlook 2007 to Outlook 2019) ...
Read more >How to Send an Attachment or Photo Through E-mail
Tips on sending attachments. Gmail; Outlook.com (formerly Hotmail). Yahoo! Apple Mail; Microsoft Outlook and Outlook Express. Mozilla ...
Read more >Why recipients may not see images in emails
Email clients refer to these as "remote" or "external" images, and may be set to display images in: no emails; a specific email...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ptums all of that looks good, except instead of:
src="cd:mailgun_logo.png"
you needsrc="cid:mailgun_logo.png"
Also, for anyone else coming here, the same logic works for multiple images by just putting the filenames in an array:
inline: [filenameone, filenametwo]
Thank you! This worked. It may help to edit this example to show people trying to add an inline image what the code should look like in the html key.
For example