Skip to content

The project represents a basic yet fully functional E-mail client, which utilizes the TRichView components to display and edit HTML messages, Clever SMTP and POP3 components to send and retrieve E-mails. The downloaded messages are scanned using the ClamAV antivirus library.

License

Notifications You must be signed in to change notification settings

CleverComponents/MailClient-AntiVirus

Repository files navigation

MailClient with AntiVirus

This Delphi project represents a basic yet fully functional E-mail client, which utilizes the TRichView components to display and edit HTML messages, Clever SMTP and POP3 components to send and retrieve E-mails. The downloaded messages are scanned using the ClamAV antivirus library.

Additionally, the program uses the MailMessage component, which allows you to create E-mails in the MIME format, including message headers, text- and HTML bodies, file attachments, and embedded images.

The HtmlViewer library is used for reading HTML bodies. The current version of MailClient utilizes the version 11.7.

The program allows you to authenticate using the username/password information. Also the SMTP component supports the OAUTH2.0, Digest, NTLM, and other SASL authentication methods. Please check out the following example to learn how to use the OAUTH2.0 protocol together with this components: GMail SMTP Client

Both the SMTP and the POP3 client components completely support the SSL/TLS mode, including the client certificate authorization and the server validation process. The following example shows how to connect to a mail server via TLS: SMTP Client SSL The other example connects to a POP3 mailbox using TLS: POP3 Client SSL

Screenshot

Read the Article

How to compile

  1. Please clone the GitHub/CleverComponents/MailClient-AntiVirus repository.
  2. Download and install the Clever Internet Suite library.
  3. Download and install the TRichView library.
  4. Download and install the HtmlViewer library.
  5. Open and compile the MailClient project in your Delphi IDE.
  6. Enjoy.

Daily virus databases (cvd files) should be downloaded and stored to the MailClient folder near the application executable: ClamAV

Notes

The current version of the MailClient project uses an outdated version of ClamAV Delphi client library. You can still download it here: ClamAV for Delphi This is a drawback, and we suggest a task to replace this library with Delphi/Object Pascal ClamAV API Binding or any other antivirus library.

Units description

  1. clRVSendMail.pas, contains:
procedure SendHTMLEmail(RV: TCustomRichView; Smtp: TclSmtp; Msg: TclMailMessage;
  HTMLKind: THTMLKind = htmlAdvanced; Attachments: TStrings = nil);
// This procedure sends a message. The message body is provided by the RV parameter,
// the other fields ("From", "To", "Subject") are from the Msg parameter.
// The message is sent using the Smtp component. You can provide an optional list of attached files.
If HTMLKind = htmlSimple, a basic HTML is used.
If HTMLKind = htmlAdvanced (recommended), HTML with CSS is used.
  1. clRVSendDialog.pas, contains:
function ComposeAndSendHTMLEmail(Smtp: TclSmtp; Msg: TclMailMessage;
  HTMLKind: THTMLKind = htmlAdvanced): Boolean;
// Shows a dialog for editing a message and sending using both the Smtp and Msg parameters.
// "From", "To", "Subject" of e-mail are initialized using the corresponding properties of Msg.
  1. clRVSendDialogEx.pas, contains:
procedure ViewHTMLEmail(MailSource: TStrings);
function EditHTMLEmail(MailSource: TStrings;
  HTMLKind: THTMLKind = htmlAdvanced): TMessageEditResult;
function ReplyToHTMLEmail(MailSource: TStrings; HowToReply: TMessageReplyKind;
  const From: String; HTMLKind: THTMLKind = htmlAdvanced;
  MaxLineLength: Integer = 80): TMessageEditResult;

(*where
  TMessageReplyKind  = (mekEdit, mekReply, mekReplyToAll, mekForward);
  TMessageEditResult = (meCancel, meSave, meSend);

  ViewHTMLEmail() displays the specified message.
  EditHTMLEmail() opens a window for editing the specified message.
  ReplyToHTMLEmail() opens a window for editing the specified message, 
    forwarding, or replying, depending on the HowToReply parameter.

  Parameters:
    MailSource - email source, this is clMailMessage.MessageSource.
    MaxLineLength is used to break lines when quoting text for replying or
    forwarding.

  This unit uses THTMLViewer and TrvHtmlViewImporter, see above.*)

Please feel free to Contact Us and ask any program related questions.

Keep updated on Facebook YouTube Twitter Telegram Newsletter

About

The project represents a basic yet fully functional E-mail client, which utilizes the TRichView components to display and edit HTML messages, Clever SMTP and POP3 components to send and retrieve E-mails. The downloaded messages are scanned using the ClamAV antivirus library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages