Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Can anyone provide the additional code required to embed the JPG picture in the body of the email using Net::SMTPS? Thanks in advance for your help.

# Email body. $smtp->datasend("--$boundary\n"); $smtp->datasend("Content-type: text/plain\n");

You have a conflict between your code and your problem description. Your problem description says that you want to embed an image, but your code shows that you are using plaintext. You cannot "embed an image" in plaintext. When Outlook sends an email with embedded images, it is either in rich text format, or in HTML. (I can see this when I compose a message in my Office 2016 Outlook client: the "Format Text" menu will show either HTML Text, Plain Text, or Rich Text. If you have an embedded image and select Plain Text, the embedded image goes away, because images are not plain text.)

So instead of doing a Content-type: text/plain, use the right header for rich text or html, and format the data in that section of the email as either rich text or html. And sorry, I don't know how to set an HTML img src to point to an attachment in your email: if you send yourself a rich text email and an HTML text email, both with embedded images, from Outlook to someplace that can read the actual source of the email, then you can see how exactly the rich text or HTML are structured to link to the image.


In reply to Re: Send Email With Picture Embedded in Body of Email by pryrt
in thread Send Email With Picture Embedded in Body of Email (SOLVED) by roho

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-25 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found