Forum Moderators: open
here is the whole code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>test</title>
</head>
<body link="#000000" vlink="#FF0000" alink="#000000">
<p align="center"><font face="Eurostile" size="7">Test page</font></p>
<div align="center">
<center>
<table width="918" border="0">
<tbody>
<tr>
<td align="middle" width="1075" colSpan="3">
<p align="center"><font face="Eurostile" size="5">testing page bla bla </font></p>
</td>
</tr>
</tbody>
</table>
</center>
</div>
<div align="center">
<center>
<table width="80%" border="0">
<tbody>
<tr>
<td width="100%">
<hr width="800">
<p class="fd_results"><font face="Verdana" size="2"><b>test alpha</b></font></p>
<p class="fd_results"><font face="Verdana" size="2">test beta</font></p>
<p class="fd_results"> </p>
<p class="fd_results">
</p>
</center>
<p class="fd_results" align="right">
<b><a href="http://"><br>
</a></b>
<font size="2" face="Verdana">Back
to the index</font>
</p>
<center>
<hr width="800">
<p> </p>
</center>
<table width="60%" border="0">
<tbody>
<tr>
<td width="100%">
<p align="left"><font face="arial,helvetica" color="#000000" size="2"><a style="color: #000000">
blabla</a><a style="COLOR: #000000">.net</a></font></p>
</tr>
</tbody>
</table>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Obviously, it is correctly formatted if I view it trough any web browser...
Thanks for any useful hint.
[edited by: tedster at 6:59 pm (utc) on June 10, 2007]
[edit reason] add breaks to prevent side-scrolling [/edit]
So that's not a script issue,I guess...
# prints report
print "Content-type: text/html\n\n";
print "<html><body>\n";
print "<p><font face=Arial Black size=4><b>test</b></font></p>\n";
print "<p><font face=Verdana><b>Your report</b></font></p>\n";
print "<p><b><font face=Verdana size=2>Today the following tests have been executed successfully:</font></b></p>\n";
foreach(@completed){
print "<p><font face=Verdana size=2>$_.htm</font></p>\n";
}
Hope it will be helpful...
specter if youre using perl, I answered your problem in the perl forum, [webmasterworld.com] but here it is again for your convenience.
The code you posted above prints to the browser. To print to mail you open a mail filehandle, then print the output to that filehandle. print "hello world" prints to STDOUT, which is whatever process calls it (the browser.)
You should find something like this in your script. The problem is the content-type headers need to print to the mail filehandle - NOT STDOUT - see bolded text below. In the below sample, ¦ is the unbroken pipe.
## Open the mail program and choose a filehandle.
## in this case, MAIL. If it's sendmail, use -t
## to extract the address from mail text and avoid
## pipe injection. The common install for sendmail
## is $your_mail_program = '/usr/sbin/sendmail';
open (MAIL,"¦ $your_mail_program -t") or die("cannot open mail program");
## Now print headers to the MAIL filehandle
print MAIL "To: $to_email\r\n";
print MAIL "From: $from\r\n";
print MAIL "Subject: $subject\r\n";
print MAIL "MIME-Version: 1.0\r\n";
print MAIL "Content-Type: text/html; charset=US-ASCII\r\n";
## Print message
print MAIL "$body";
## Close filehandle, flushing buffer or the message will be blank
close (MAIL);
Also note after the last header, use only one \r\n. Unlike printing to the browser, using two can munge up the header and case it to print as plain text in some email clients.
But I have that problem with any html code I copy/paste in a mail body, even if not script-generated
This is a different issue and has to do with the settings in the mail client. The client is converting your html carats to entities or ASCII equivalents, so they will display as you've pasted it. You can probably set the mail client to parse HTML in the body of the mail.
A better alternative in this case *might* be to send an html page as an attachment, then set the client (temporarily) to include text or html attachments in the body of the email.
Really,I receive the report via e-mail because the script is cron-executed daily, and the cron output is sent to the mail address I specified in the control panel.
So, the report subroutine is not proper for mail files.
Now, I need to know how to edit properly that script so that it will send autonomously proper email formatted file to my mailbox.
I wait your kind replies in the perl thread.Thanks.
[webmasterworld.com...]