Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sendmail problem

Status
Not open for further replies.

kyucu

Programmer
Jan 10, 2003
2
US
Hi everyone,
I got a problem. I hope someone can help me out.
I am using jrun: senmail to send email. And use <%@ include file = &quot;/data/message.txt&quot; %> to include the message:
<jrun:sendmail
host=&quot;host&quot;
sender=&quot;me@yahoo.com&quot;
recipient=&quot;recipient@yahoo.com&quot;
subject=&quot;Welcome email&quot; >
<%@ include file = &quot;/data/Welcome_email.txt&quot; %>
</jrun:sendmail>

The problem is that when the people receive the email, the message is unformat. It doesn't look like the way when it is in the text file. It is totally unformat, only one paragraph.
I want people receive the message with the same format as it is in text file. Is there a way to do it?
Thanks for any help!!!
 
I'd be willing to bet that the program that created the .txt file doesn't put both carraige returns and line feeds at the end of each line. Programs written for or with Unix, and java by default only include one of them. Windows likes having them both.

You may want to pre-process the text file and insert the missing CRLFs at the end of each line. Read in the text and then write it out to a temp file with CRLF at the end like this:

out.write( text, 0, text.length() );
out.write( &quot;\r\n&quot; );

Hope this helps...
 
idarke,
Thank you!
But I think that is not the issue. After I converted the .txt file to .html file, people will get the message in the same format as in the HTML file. Seems like the sendmail treats the file in<%@ include file =&quot;&quot; %> as HTML format. But now, for some reason I can't use a HTML file when I send out this message.
Is there any other ways to solve this problem?
Thanks a lot for the help!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top