Board index » cppbuilder » How to get line feeds in the body of IdSMTP
David Ayre
![]() CBuilder Developer |
David Ayre
![]() CBuilder Developer |
How to get line feeds in the body of IdSMTP2008-01-16 01:37:20 AM cppbuilder104 Hi, I'm using the IdSMTP component to send emails, multipart, and it basically works fine. However, when I enter text into th body section of the IdMessage, I lose any linefeeds there might have been. This is my code:- TIdText *Text = new TIdText(IdMessage1->MessageParts,NULL); Text->ContentType = "text/plain"; Text->Body->Text = acBody; Where acBody is char acBody[512]; I am using BDS2006 on an XP machine. I have tried inserting \r\n etc., but to no avail. I have also tried using the Text from a TMemo. What am I doing wrong? Thanks, David |
David Ayre
![]() CBuilder Developer |
2008-01-16 02:05:21 AM
Re:How to get line feeds in the body of IdSMTP
Asger Joergensen < XXXX@XXXXX.COM >wrote:
Quote
Quote
David |
David Ayre
![]() CBuilder Developer |
2008-01-16 02:14:15 AM
Re:How to get line feeds in the body of IdSMTP
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
and the received email comes out like this:- Some words.Some more wordsEtc etc I have also tried entering the message into a TMemo with WantReturns set true and then doing this:- strcpy(acBody,Memo1->Text.c_str()); and I get the same result. Cheers, David {smallsort} |
Asger Joergensen
![]() CBuilder Developer |
2008-01-16 02:59:17 AM
Re:How to get line feeds in the body of IdSMTP
Hi David
David Ayre says: Quote
it goes throug a unix/linux server så You might need to do a replace on the recieved text: Replace \n with \r\n P.s. please break Your text lines. Kind regards Asger |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2008-01-16 03:04:40 AM
Re:How to get line feeds in the body of IdSMTP
"David Ayre" < XXXX@XXXXX.COM >wrote in message
QuoteHowever, when I enter text into th body section of the IdMessage, QuoteWhere acBody is char acBody[512]; |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2008-01-16 03:06:53 AM
Re:How to get line feeds in the body of IdSMTP
"Asger Joergensen" < XXXX@XXXXX.COM >wrote in message
QuoteI don't know the answer to Your problem, but I just thought lines into the Strings[] property. When the message is actually sent, each entry in the Strings[] property is re-appended with \r\n again, as per RFC specs. At that point, the data in in the email system's hands, not Indy's. Gambit |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2008-01-16 05:59:10 AM
Re:How to get line feeds in the body of IdSMTP
"David Ayre" < XXXX@XXXXX.COM >wrote in message
Quotestrcpy(acBody,"Some words.\r\nSome more words\r\nEtc etc"); Quoteand the received email comes out like this:- Quotestrcpy(acBody,Memo1->Text.c_str()); and I get the same result. strncpy(acBody, Memo1->Text.c_str(), 511); Gambit |
David Ayre
![]() CBuilder Developer |
2008-01-16 05:04:04 PM
Re:How to get line feeds in the body of IdSMTP
"Remy Lebeau \(TeamB\)" < XXXX@XXXXX.COM >wrote:
Quote
Quote
description of what I was doing. Cheers, David |
David Ayre
![]() CBuilder Developer |
2008-01-16 05:23:26 PM
Re:How to get line feeds in the body of IdSMTPQuote>Please show a log of the actual SMTP transmission from a packet sniffer, Quote
|
David Ayre
![]() CBuilder Developer |
2008-01-16 05:31:40 PM
Re:How to get line feeds in the body of IdSMTP
"David Ayre" < XXXX@XXXXX.COM >wrote:
Quote
Content-Type: multipart/mixed; boundary="=_MoreStuf_2zzz1234sadvnqw3nerasdf" MIME-Version: 1.0 Date: Wed, 16 Jan 2008 10:10:02 +0000 This is a multi-part message in MIME format --=_MoreStuf_2zzz1234sadvnqw3nerasdf Content-Type: multipart/alternative; boundary="=_MoreStuf_2altzzz1234sadvnqw3nerasdf" --=_MoreStuf_2altzzz1234sadvnqw3nerasdf Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Attached is the list of produce for which we would like you to quote cur= rent prices. The file can be opened in Excel and the prices, and quantit= ies for the price, can be entered in the first two columns. Using 'Save As', save the file as a csv file and email it back to us. Best regards, Company Name Cheers, David |
David Ayre
![]() CBuilder Developer |
2008-01-16 05:48:03 PM
Re:How to get line feeds in the body of IdSMTPQuote> accept HTML that the problem occurs. Here is the log extract for the HTML message:- --=_MoreStuf_2altzzz1234sadvnqw3nerasdf Content-Type: text/html Content-Transfer-Encoding: quoted-printable <html>Attached is the list of produce for which we would like you to quo= te current prices. The file can be opened in Excel and the prices, and q= uantities for the price, can be entered in the first two columns. Using 'Save As', save the file as a csv file and email it back to us. Best regards, Company Name</html> Am I setting something wrong in the HTML section? This is my code:- TIdText *html = new TIdText(IdMessage1->MessageParts,NULL); html->ContentType = "text/html"; char acHtml[512]; sprintf(acHtml,"<html>%s</html>",acBody); html->Body->Text = acHtml; Cheers, David |
David Ayre
![]() CBuilder Developer |
2008-01-16 08:50:45 PM
Re:How to get line feeds in the body of IdSMTP
Asger Joergensen < XXXX@XXXXX.COM >wrote:
Quote
Problem solved. Thanks for the help. Cheers, David |
Asger Joergensen
![]() CBuilder Developer |
2008-01-16 09:07:12 PM
Re:How to get line feeds in the body of IdSMTP
Hi David
David Ayre says: QuoteOn further investigation I find that if I set Outlook Express to Kind regards Asger |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2008-01-17 02:34:58 AM
Re:How to get line feeds in the body of IdSMTP
"David Ayre" < XXXX@XXXXX.COM >wrote in message
QuoteI tried Ethereal but don't know how to interpret the results. |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2008-01-17 02:35:44 AM
Re:How to get line feeds in the body of IdSMTP
"David Ayre" < XXXX@XXXXX.COM >wrote in message
QuoteThis is an extract of the saved log file:- |