Sends an email based on params.

Namespace: DotNetNuke.Services.Mail
Assembly: DotNetNuke (in DotNetNuke.dll)

Syntax

C#
public static string SendMail(
	string mailFrom,
	string mailTo,
	string cc,
	string bcc,
	string replyTo,
	MailPriority priority,
	string subject,
	MailFormat bodyFormat,
	Encoding bodyEncoding,
	string body,
	string[] attachments,
	string smtpServer,
	string smtpAuthentication,
	string smtpUsername,
	string smtpPassword,
	bool smtpEnableSSL
)
Visual Basic
Public Shared Function SendMail ( 
	mailFrom As String,
	mailTo As String,
	cc As String,
	bcc As String,
	replyTo As String,
	priority As MailPriority,
	subject As String,
	bodyFormat As MailFormat,
	bodyEncoding As Encoding,
	body As String,
	attachments As String(),
	smtpServer As String,
	smtpAuthentication As String,
	smtpUsername As String,
	smtpPassword As String,
	smtpEnableSSL As Boolean
) As String

Parameters

mailFrom
Type: System..::..String
Email sender
mailTo
Type: System..::..String
Recipients, can be more then one separated by semi-colons
cc
Type: System..::..String
CC-recipients, can be more then one separated by semi-colons
bcc
Type: System..::..String
BCC-recipients, can be more then one separated by semi-colons
replyTo
Type: System..::..String
Reply-to email to be displayed for recipients
priority
Type: DotNetNuke.Services.Mail..::..MailPriority
parampriorityM:DotNetNuke.Services.Mail.Mail.SendMail(System.String,System.String,System.String,System.String,System.String,DotNetNuke.Services.Mail.MailPriority,System.String,DotNetNuke.Services.Mail.MailFormat,System.Text.Encoding,System.String,System.String[],System.String,System.String,System.String,System.String,System.Boolean)
subject
Type: System..::..String
Subject of email
bodyFormat
Type: DotNetNuke.Services.Mail..::..MailFormat
parambodyFormatM:DotNetNuke.Services.Mail.Mail.SendMail(System.String,System.String,System.String,System.String,System.String,DotNetNuke.Services.Mail.MailPriority,System.String,DotNetNuke.Services.Mail.MailFormat,System.Text.Encoding,System.String,System.String[],System.String,System.String,System.String,System.String,System.Boolean)
bodyEncoding
Type: System.Text..::..Encoding
Email Encoding from System.Text.Encoding
body
Type: System..::..String
Body of email
attachments
Type: array<System..::..String>[]()[][]
List of filenames to attach to email
smtpServer
Type: System..::..String
IP or ServerName of the SMTP server. When empty or null, then it takes from the HostSettings
smtpAuthentication
Type: System..::..String
SMTP authentication method. Can be "0" - anonymous, "1" - basic, "2" - NTLM. When empty or null, then it takes from the HostSettings.
smtpUsername
Type: System..::..String
SMTP authentication UserName. When empty or null, then it takes from the HostSettings.
smtpPassword
Type: System..::..String
SMTP authentication Password. When empty or null, then it takes from the HostSettings.
smtpEnableSSL
Type: System..::..Boolean
Enable or disable SSL.

Return Value

Returns an empty string on success mail sending. Otherwise returns an error description.

Examples

SendMail( "[email protected]", "[email protected]", "[email protected];[email protected]", "[email protected]", "[email protected]", MailPriority.Low, "This is test email", MailFormat.Text, Encoding.UTF8, "Test body. Test body. Test body.", new string[] {"d:\documents\doc1.doc","d:\documents\doc2.doc"}, "mail.email.com", "1", "[email protected]", "AdminPassword", false);

See Also