[DUG] SMTP Server Component

Matthew Comb matt at ferndigital.com
Wed Nov 28 22:24:44 NZDT 2007


Hi Neven,

Try the following:

var MultiPartMix, MultiPartRel, MultiPartAlt: TMimePart;

MimeMessage := TMimeMess.Create
Try

  { multiparts (parent-parts) }
  MultiPartMix := MimeMessage.AddPartMultipart('mixed', nil);
  MultiPartRel := MimeMessage.AddPartMultipart('related', MultiPartMix);
  MultiPartAlt := MimeMessage.AddPartMultipart('alternative', MultiPartRel);

  { plain text-part }
  MIMESSAGE.AddPartText([Your Text], MultiPartAlt);

  { html-part }
  MimeMessage.AddPartHTML([Your HTML], MultiPartAlt);

  { embedded images }
  MimeMessage.AddPartHTMLBinary([Your image-stream1], [Your Filename1],
[Your
  ContentID], MultiPartRel);
  MimeMessage.AddPartHTMLBinary([Your image-stream2], [Your Filename2],
[Your
  ContentID], MultiPartRel);

  { attachments }
  MimeMessage.AddPartHTMLBinary([Your attachment-stream1], [Your Filename1],
  MultiPartMix);

  { encode message }
  MimeMessage.EncodeMessage;

  { send message via SMTP }
  SMTP := TSMTPSend.Create;
  try
    SMTP.SendToEx([MailFrom-address], [MailTo-address], [mail-subject],
[STMP-host], MimeMessage.Lines, [account-Username], [account-Password]);
  finally
    SMTP.Free;
  end;

finally
  MimeMessage.Free;
end;

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Neven MacEwan
Sent: Wednesday, 28 November 2007 6:01 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] SMTP Server Component

Matt

Do you have any example of using SMTPsender with an attachment?

Thanks
> I wouldn't use anything but synapse for socket stuff... so clean and
> compact.
>
> Matt.
>
> -----Original Message-----
> From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On
> Behalf Of Neven MacEwan
> Sent: Monday, 26 November 2007 2:43 p.m.
> To: DUG
> Subject: [DUG] SMTP Server Component
>
> Hi all
>
> I know there are a lot of SMTP Client comonents available but can anyone 
> suggest the "best of breed"?
>
> TIA Neven
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe
>
>
>   

_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe




More information about the Delphi mailing list