How to send an image by mail in the body?










0















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










share|improve this question

















  • 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
















0















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










share|improve this question

















  • 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














0












0








0








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










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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













  • 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













2 Answers
2






active

oldest

votes


















0














either host it somewhere or embed it by encoding it in base64



<img src="data:image/png;base64,BASE64IMGCONTENTHERE" />





share|improve this answer






























    0














    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="">





    share|improve this answer






















      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
      );



      );













      draft saved

      draft discarded


















      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









      0














      either host it somewhere or embed it by encoding it in base64



      <img src="data:image/png;base64,BASE64IMGCONTENTHERE" />





      share|improve this answer



























        0














        either host it somewhere or embed it by encoding it in base64



        <img src="data:image/png;base64,BASE64IMGCONTENTHERE" />





        share|improve this answer

























          0












          0








          0







          either host it somewhere or embed it by encoding it in base64



          <img src="data:image/png;base64,BASE64IMGCONTENTHERE" />





          share|improve this answer













          either host it somewhere or embed it by encoding it in base64



          <img src="data:image/png;base64,BASE64IMGCONTENTHERE" />






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 15:50









          AndreaAndrea

          412314




          412314























              0














              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="">





              share|improve this answer



























                0














                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="">





                share|improve this answer

























                  0












                  0








                  0







                  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="">





                  share|improve this answer













                  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="">






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 13 '18 at 15:51









                  AbidAbid

                  2371417




                  2371417



























                      draft saved

                      draft discarded
















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      Kleinkühnau

                      Makov (Slowakei)

                      Deutsches Schauspielhaus