SMTP & Rich Text 
Author Message
 SMTP & Rich Text

Hi all
I am trying to use the SMTP component in delphi 5 to send an email in Rich
Text format.  I have set the property to "Enriched".
I load in a Rich Text document to a RTMemo and it looks fine.  I then load
it into the Body of the PostMessage property and send it but all the
formatting disappears when the email comes through.
I have tried saving to a stream and loading back but then all I get is a raw
text message with all the RTF codes.
Any ideas?

Regards
John

........................................
procedure TfrmLetterProcessingRun.EmailDocument;
var
   i: integer;
   p: integer;
   vLine: string;
   TempStream: TMemoryStream;
begin
     EmailBody.Clear;

EmailBody.Lines.LoadFromFile(frmLetterProcessing.tblLetterDocumentLocation.T
ext);
     for i:=0 to EmailBody.Lines.Count-1 do
     begin
          vLine:=EmailBody.Lines[i];
          if Pos('&&',vLine)>0 then
          begin
               p:=Pos('&&Salutation&&',vLine);
               if p>0 then
               begin
                    Delete(vLine,p,14);

Insert(frmLetterProcessing.tblLetterDetailContactSalutation.Value,vLine,p);
               end;
          end;
          EmailBody.Lines[i]:=vLine;
     end;

     SMTP.PostMessage.LocalProgram := 'Marketing v2.0';
     SMTP.PostMessage.FromName := 'GBA Computer Solutions';
     SMTP.PostMessage.FromAddress := tblDocumentEmailFrom.Value;
     SMTP.PostMessage.Subject := tblDocumentEmailDesc.Value;
     SMTP.PostMessage.ToAddress.Clear;

     SMTP.PostMessage.ToBlindCarbonCopy.Text:='';
     SMTP.PostMessage.ToCarbonCopy.Text:='';
     SMTP.PostMessage.Attachments.Text:='';
     SMTP.PostMessage.Body.Clear;

     try
        TempStream:=TMemoryStream.Create;
        EmailBody.Lines.SaveToStream(TempStream);
        TempStream.Position:=0;
        SMTP.PostMessage.Body.LoadFromStream(TempStream);
     finally
        TempStream.Free;
     end;

     try
        SMTP.SendMail;
     except
           ShowMessage( 'There was a problem sending mail to the SMTP
server.'#13+
                        'Please contact network administator.'#13'IP Address
= '+SMTP.Host);
           Exit;
     end;
end;



Sat, 08 Nov 2003 00:14:01 GMT  
 SMTP & Rich Text

Quote:

> I am trying to use the SMTP component in Delphi 5 to send an email in Rich
> Text format.  I have set the property to "Enriched".
> I load in a Rich Text document to a RTMemo and it looks fine.  I then load
> it into the Body of the PostMessage property and send it but all the
> formatting disappears when the email comes through.
> I have tried saving to a stream and loading back but then all I get is a raw
> text message with all the RTF codes.
> Any ideas?

This group is not about Delphi (it is about Borland Pascal). Please post
your question in a Delphi group.


Sat, 08 Nov 2003 00:23:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Saving Rich Text to sql server Text Fields

2. Sending and receiving email (SMTP & POP3)

3. Rich text stored to field in table???

4. Rich-text Format Database in Delphi

5. Printing Rich Text from a Database

6. Rich text, Quick Reports and Access Violations

7. Rich Text Format

8. Need help with Rich Text Format

9. Searching Rich text in Blob fields

10. Need help with Rich Text Format

11. Flaky Quick Report Rich Text Component.

12. Rich Text Format Tmemo or TDBMemo ???

 

 
Powered by phpBB® Forum Software