MailBee.NET Objects 4.0

Smtp.QuickSend Method (String, String, String, String, String, String, String)

Sends a mail message, in a single line of code.

public static void QuickSend(
   string from,
   string to,
   string subject,
   string plainTextBody,
   string htmlBody,
   string charset,
   string attachmentFilename
);

Parameters

from
The string containing the sender e-mail address.
to
The comma-separated list of the message recipients.
subject
The subject of the message.
plainTextBody
The plain-text version of the message body, or a null reference (Nothing in visual Basic) if the message should not contain the plain-text body.
htmlBody
The HTML version of the message body, or a null reference (Nothing in visual Basic) if the message should not contain the HTML body.
charset
The charset the message is composed in, or a null reference (Nothing in visual Basic) if the message should not contain any charset setting.
attachmentFilename
The full path and filename of the file to be attached to the message, or a null reference (Nothing in visual Basic) if no attachment is required.

Remarks

This method allows the developer to send a mail message without needing to create an instances of Smtp component and MailMessage class.

The message will be sent in direct send mode. MailBee will discover SMTP servers of recipients domains via DNS MX lookup, and then send the message directly to these SMTP MX servers. No dedicated SMTP relay server is used.

DNS servers for MX lookup are taken either from the config file (such as app.config, web.config, or machine.config) or from operating system settings if the config file contains no DNS server definitions. See Autodetect method for more information.

Note   Although this method is static, it still requires valid license key be assigned to the Smtp class. The developer can set the key either in the config file or in the code (by setting LicenseKey property value).

Exceptions

Exception TypeCondition
MailBeeExceptionAn error occurred.

Example

This sample composes and sends an HTML mail message with an attachment in a single line of code.

[C#]
MailBee.SmtpMail.Smtp.QuickSend("John Doe <jdoe@domain.com>",
"Kathy Smith <kathy.smith@company.com>", "The requested document", null,
"<html>Please find the report in the attached document</html>", null,
@"C:\My Documents\report.doc");
[Visual Basic]
MailBee.SmtpMail.Smtp.QuickSend("John Doe <jdoe@domain.com>", _
    "Kathy Smith <kathy.smith@company.com>", "The requested document", Nothing, _
    "<html>Please find the report in the attached document</html>", Nothing, _
    "C:\My Documents\report.doc")

See Also

Smtp Class | MailBee.SmtpMail Namespace | Smtp.QuickSend Overload List | Send