How to send an image by mail in the body?
I am trying to send an email in which I want an image to be sent in the body, not that the image is attached, but the mail arrives to me without the image.
I'm embedding it in the traditional way as in an html template
<img src=" asset('img/mails/birthdays.jpg') " alt="">
But the mail arrives empty, how to make the image arrive?
I am using laravel
php laravel email
|
show 1 more comment
I am trying to send an email in which I want an image to be sent in the body, not that the image is attached, but the mail arrives to me without the image.
I'm embedding it in the traditional way as in an html template
<img src=" asset('img/mails/birthdays.jpg') " alt="">
But the mail arrives empty, how to make the image arrive?
I am using laravel
php laravel email
1
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
1
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50
|
show 1 more comment
I am trying to send an email in which I want an image to be sent in the body, not that the image is attached, but the mail arrives to me without the image.
I'm embedding it in the traditional way as in an html template
<img src=" asset('img/mails/birthdays.jpg') " alt="">
But the mail arrives empty, how to make the image arrive?
I am using laravel
php laravel email
I am trying to send an email in which I want an image to be sent in the body, not that the image is attached, but the mail arrives to me without the image.
I'm embedding it in the traditional way as in an html template
<img src=" asset('img/mails/birthdays.jpg') " alt="">
But the mail arrives empty, how to make the image arrive?
I am using laravel
php laravel email
php laravel email
asked Nov 13 '18 at 15:40
Edwin AquinoEdwin Aquino
848
848
1
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
1
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50
|
show 1 more comment
1
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
1
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50
1
1
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
1
1
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50
|
show 1 more comment
2 Answers
2
active
oldest
votes
either host it somewhere or embed it by encoding it in base64
<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />
add a comment |
use this to get the full path
<img src="data:image/png;base64,base64_encode(file_get_contents(resource_path('img/mails/birthdays.jpg')))" alt="">
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284527%2fhow-to-send-an-image-by-mail-in-the-body%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
either host it somewhere or embed it by encoding it in base64
<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />
add a comment |
either host it somewhere or embed it by encoding it in base64
<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />
add a comment |
either host it somewhere or embed it by encoding it in base64
<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />
either host it somewhere or embed it by encoding it in base64
<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />
answered Nov 13 '18 at 15:50
AndreaAndrea
412314
412314
add a comment |
add a comment |
use this to get the full path
<img src="data:image/png;base64,base64_encode(file_get_contents(resource_path('img/mails/birthdays.jpg')))" alt="">
add a comment |
use this to get the full path
<img src="data:image/png;base64,base64_encode(file_get_contents(resource_path('img/mails/birthdays.jpg')))" alt="">
add a comment |
use this to get the full path
<img src="data:image/png;base64,base64_encode(file_get_contents(resource_path('img/mails/birthdays.jpg')))" alt="">
use this to get the full path
<img src="data:image/png;base64,base64_encode(file_get_contents(resource_path('img/mails/birthdays.jpg')))" alt="">
answered Nov 13 '18 at 15:51
AbidAbid
2371417
2371417
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284527%2fhow-to-send-an-image-by-mail-in-the-body%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You will have to host the image and add a direct url in your email template.
– Jerodev
Nov 13 '18 at 15:44
Are you sending and HTML email?
– nforced
Nov 13 '18 at 15:47
@Jerodev I already tried doing that but also the image does not arrive
– Edwin Aquino
Nov 13 '18 at 15:48
@nforced I send it using a laravel blade template
– Edwin Aquino
Nov 13 '18 at 15:48
1
The code you have shown is not "embedding" - you are simply referencing the image on your server. If you want to embed an image - ie encode it and send it as data along with the rest of the email content - the Laravel docs describe how to do that.
– Don't Panic
Nov 13 '18 at 15:50