Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Sending email with both html and plaintext

by mavericknik (Sexton)
on Feb 18, 2016 at 21:16 UTC ( #1155588=note: print w/replies, xml ) Need Help??


in reply to Re: Sending email with both html and plaintext
in thread Sending email with both html and plaintext

Yes I did try "multipart/mixed". What this does is sends whatever I attach first in the body of the email, and what I attach second as an attachment to the email. So in this example, I get "THIS IS DIRECTLY ATTACHED TEXT" in the body of the email and "THIS IS HTML TEXT" as a seperate .html attachment in the same email. Is there any other type I can try?
  • Comment on Re^2: Sending email with both html and plaintext

Replies are listed 'Best First'.
Re^3: Sending email with both html and plaintext
by CountZero (Bishop) on Feb 19, 2016 at 07:38 UTC
    I think that is the expected behaviour: one email with attachments.

    Perhaps you can force your email reader to show the attachment as an email message if the attachment is a proper email message in its own right? I remember that the email reader on my BlackBerry would show all attachemnts that are proper emails indeed as one continuing email and not as a separate attachments.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      The problem is the script is suppposed to send out 100's of emails, all to outlook configured the way I have mine set up now. So making changes in outlook does not really solve my problem. I just gave up and am generating a single html code for everything I want to send. Had to make changes to the script but I couldnt figure out another way.

        The only way to guarantee everything in the message will be treated as being in the body of the message is to put everything in the first (or only) part of the message.

        When mixing plain text with HTML, you can surround the plain test with <tt> ... </tt> tags. Or you can use a text-to-html filter to reformat your text into html.

        If your message's main body is in html, you can "embed" attachments in the main body and they will be displayed as part of the main body. This is done using the <embed> or <object> tags to refer to the individual attachments. The are not actually embedded in the main body, merely "included by reference". But this is still relying on HTML tricks. The reason for doing this would be so the "extra" content you are including in the body is also available for individually saving without duplicating the content in the body and as attachments.

Re^3: Sending email with both html and plaintext
by soonix (Canon) on Feb 19, 2016 at 06:16 UTC
    Add an (additional) empty text before your first attachment?
      But that just makes my email have 2 attachments, I want both in the body not as attachments.
        You can only have 1 body, and a body consisting of both plain text and HTML is simply not possible. The first plain text attachment apparently ends up as body, so you could make that an explaining text.

        If you want it all in the body, you could incorporate the plain text part as a <pre>-formatted part into the HTML and use that as body. I prefer plain text mails, therefore haven't done that yet, but it should work that way, too.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1155588]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2022-12-02 13:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?