in reply to MIME Lite no line feed in Message body

Your content type is text/html. HTML line breaks are different from text line feeds.

Either learn about HTML or use text/plain as your content type. You might also want to think about the character encoding and specify that as well.

Replies are listed 'Best First'.
Re^2: MIME Lite no line feed in Message body
by sudheer157 (Initiate) on Jun 26, 2011 at 12:10 UTC
    Thanks Corion,
    changing it to "text/plain" resolved the issue.

    is there any way perl can interpret the format automatically if the file is a plain or html, because my case is the body file may be a plain or html file. so really need a way to identify the format and use plain or html accordingly. Any Ideas?
      "so really need a way to identify the format and use plain or html accordingly."

      If you're sending it, you should know what the content is. So, no, you don't "really need" some external evaluation of the file type... unless you're being paid to send spam without reviewing the content :-)

      That said, you might also consider a file test construct like:

      unless -T $FH ...(do something) See http://perldoc.perl.org/perlfunc.html

      But - - IMO - - it's "the long way around Robin Hood's barn" to code up file-type-test procedures and translate their output to something you can stick into $mime_msg->attach(Type => '.... unless you have some need to send files whose type is not readily discernable by inspection... or such a volume to send that inspection is impractical.

      PS, just in case: the idiom marked with quotes in the previous para translates (roughly) to "the hard way" or "a poor way."

        Thanks for your reply Derby&WW

        Thing is i am writing a generic script which can accpet n number of attachements(plain/html/pdf/csv -- here i need to find out the attachment type programatically). the first attachement should go as the email body content(can be plain/html) and the rest of the attachemnts as attached to email. Able to attach any number of attachements. but failing to attach the first one inside the body of the email( is also going as external attachment).

        Any cool way to achive this ??