bory has asked for the wisdom of the Perl Monks concerning the following question:

Hello great perlmonks, I have the code below for sending an email but when i rceive the email, the information is displayed chaotic:
$sender=new Mail::Sender {smtp=>'155.142.124.145', from=>'test@yahoo.com'}; $sender->OpenMultipart({to=>'test1@hotmail.com',subject=>"This is a te +st!"}); $sender->Part({ctype=>'text/html',disposition=>'None',encoding=>'quote +d-printable'}); $msg=qq (<html><body><br><table border=2 width=100> <tr><td colspan=2><h3>My Information</h3></td><td></td></tr> <tr><td>From</td><td><font color=blue>Bory</font></td></tr> <tr><td >My Information</td><td width=100><fontcolor=blue> DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30.0__CL </font></td></tr></table></center> ); $body=qq (</body></html>); $sender->SendEnc($msg,$body); $sender->Close();
The problem is for eg in the tabel row My Information, the information is displayed on the same row while I want to be displayed on three separate rows!I always have this kind of problems of displaying on different rows! Another aspect is the difference between the browsers:If I open this email with Netscape the display is different from IE; Thank you for your time.

Replies are listed 'Best First'.
Re: content of an email
by matija (Priest) on Apr 16, 2004 at 07:01 UTC
    You may want to display it in three lines, but you're telling the HTML you want it displayed in one line:
    <tr><td >My Information</td><td width=100><fontcolor=blue> DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30.0__CL </font></td>
    Maybe you should change that table so that each BORY line has a <tr> pair of it's own - or at the very least, you should force newlines with <br>.
      In other words, HTML considers any amount of white space (including carriage returns) to be equivalent to a single space. Hence writing
      <tr><td >My Information</td><td width=100><fontcolor=blue> DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30.0__CL </font></td>
      is the same as writing
      <tr><td >My Information</td><td width=100><fontcolor=blue> DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30 +.0__CL </font></td>
      As matija says, the solution is to use <tr> pairs around each line -- this creates new lines for your table. If you put 'border="1"' in the table definition, you would see that each row is in a different cell of the table. The other solution, also mentioned above, using <br> would put all the information into one single row, but still separated on different lines.
        Thank you very much for your solution!I have corected the code and now it displayes properly. Thanks again for you time
Re: content of an email
by herveus (Prior) on Apr 16, 2004 at 11:20 UTC
    Howdy!

    $sender=new Mail::Sender {smtp=>'155.142.124.145', from=>'test@yahoo.com'}; $sender->OpenMultipart({to=>'test1@hotmail.com',subject=>"This is a te +st!"}); $sender->Part({ctype=>'text/html',disposition=>'None',encoding=>'quote +d-printable'}); $msg=qq (<html><body><br><table border=2 width=100> <tr><td colspan=2><h3>My Information</h3></td><td></td></tr> <tr><td>From</td><td><font color=blue>Bory</font></td></tr> <tr><td >My Information</td><td width=100><fontcolor=blue> DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30.0__CL </font></td></tr></table></center> ); $body=qq (</body></html>); $sender->SendEnc($msg,$body); $sender->Close();

    The problem begins with "ctype=>text/html". s/html/text/

    Then, the rest follows very nicely:

    $msg=qq (My Information From Bory My Information DIV_BORY__V10.30.0__AR LIV_BORY_1696_V10.30.0__HD LIV_BORY_162X_V10.30.0__CL ); $sender->SendEnc($msg);

    White space is honored. It works on all email clients.

    yours,
    Michael