• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class Mail

Inheritance
System.Object
Mail
Namespace: DotNetNuke.Services.Mail
Assembly: DotNetNuke.dll
Syntax
public class Mail : object

Methods

| Improve this Doc View Source

ConvertToText(String)

Declaration
public static string ConvertToText(string sHTML)
Parameters
Type Name Description
System.String sHTML
Returns
Type Description
System.String
| Improve this Doc View Source

IsValidEmailAddress(String, Int32)

Declaration
public static bool IsValidEmailAddress(string email, int portalid)
Parameters
Type Name Description
System.String email
System.Int32 portalid
Returns
Type Description
System.Boolean
| Improve this Doc View Source

SendEmail(String, String, String, String, String, ICollection<MailAttachment>)

Declaration
public static string SendEmail(string fromAddress, string senderAddress, string toAddress, string subject, string body, ICollection<MailAttachment> attachments)
Parameters
Type Name Description
System.String fromAddress
System.String senderAddress
System.String toAddress
System.String subject
System.String body
ICollection<MailAttachment> attachments
Returns
Type Description
System.String
| Improve this Doc View Source

SendEmail(String, String, String, String, String, List<Attachment>)

Declaration
public static string SendEmail(string fromAddress, string senderAddress, string toAddress, string subject, string body, List<Attachment> attachments)
Parameters
Type Name Description
System.String fromAddress
System.String senderAddress
System.String toAddress
System.String subject
System.String body
List<Attachment> attachments
Returns
Type Description
System.String
| Improve this Doc View Source

SendEmail(String, String, String, String, String)

Declaration
public static void SendEmail(string fromAddress, string senderAddress, string toAddress, string subject, string body)
Parameters
Type Name Description
System.String fromAddress
System.String senderAddress
System.String toAddress
System.String subject
System.String body
| Improve this Doc View Source

SendEmail(String, String, String, String)

Declaration
public static void SendEmail(string fromAddress, string toAddress, string subject, string body)
Parameters
Type Name Description
System.String fromAddress
System.String toAddress
System.String subject
System.String body
| Improve this Doc View Source

SendMail(UserInfo, MessageType, PortalSettings)

Send an email notification.

Declaration
public static string SendMail(UserInfo user, MessageType msgType, PortalSettings settings)
Parameters
Type Name Description
UserInfo user

The user to whom the message is being sent.

MessageType msgType

The type of message being sent.

PortalSettings settings

Portal Settings.

Returns
Type Description
System.String

NullString.

| Improve this Doc View Source

SendMail(Int32, Int32, MessageType, PortalSettings)

Send an email notification.

Declaration
public static string SendMail(int portalId, int userId, MessageType msgType, PortalSettings settings)
Parameters
Type Name Description
System.Int32 portalId

The PortalId of the user to whom the message is being sent.

System.Int32 userId

The UserId of the user to whom the message is being sent.

MessageType msgType

The type of message being sent.

PortalSettings settings

Portal Settings.

Returns
Type Description
System.String

NullString.

| Improve this Doc View Source

SendMail(String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String, String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, string attachment, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
System.String attachment
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String, String, String, String, String, Boolean)

Send a simple email.

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, string attachment, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom

Email sender.

System.String mailTo

Recipients, can be more then one separated by semi-colons.

System.String cc

CC-recipients, can be more then one separated by semi-colons.

System.String bcc

BCC-recipients, can be more then one separated by semi-colons.

MailPriority priority

MailPriority.

System.String subject

Subject of email.

MailFormat bodyFormat

MailFormat.

Encoding bodyEncoding

Email Encoding from System.Text.Encoding.

System.String body

Body of email.

System.String attachment

A filename to attach to the email (or for no attachment).

System.String smtpServer

IP or ServerName of the SMTP server. When empty or null, then it takes from the HostSettings.

System.String smtpAuthentication

SMTP authentication method. Can be "0" - anonymous, "1" - basic, "2" - NTLM. When empty or null, then it takes from the HostSettings.

System.String smtpUsername

SMTP authentication UserName. When empty or null, then it takes from the HostSettings.

System.String smtpPassword

SMTP authentication Password. When empty or null, then it takes from the HostSettings.

System.Boolean smtpEnableSSL

Enable or disable SSL.

Returns
Type Description
System.String

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

| Improve this Doc View Source

SendMail(String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String, String, String, String, String)

Send a simple email.

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, string attachment, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword)
Parameters
Type Name Description
System.String mailFrom

Email sender.

System.String mailTo

Recipients, can be more then one separated by semi-colons.

System.String cc

CC-recipients, can be more then one separated by semi-colons.

System.String bcc

BCC-recipients, can be more then one separated by semi-colons.

MailPriority priority

MailPriority.

System.String subject

Subject of email.

MailFormat bodyFormat

MailFormat.

Encoding bodyEncoding

Email Encoding from System.Text.Encoding.

System.String body

Body of email.

System.String attachment

A filename to attach to the email (or for no attachment).

System.String smtpServer

IP or ServerName of the SMTP server. When empty or null, then it takes from the HostSettings.

System.String smtpAuthentication

SMTP authentication method. Can be "0" - anonymous, "1" - basic, "2" - NTLM. When empty or null, then it takes from the HostSettings.

System.String smtpUsername

SMTP authentication UserName. When empty or null, then it takes from the HostSettings.

System.String smtpPassword

SMTP authentication Password. When empty or null, then it takes from the HostSettings.

Returns
Type Description
System.String

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

| Improve this Doc View Source

SendMail(String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String[], String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, string[] attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
System.String[] attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String[], String, String, String, String, Boolean)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, string[] attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
System.String[] attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, ICollection<MailAttachment>, String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, ICollection<MailAttachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
ICollection<MailAttachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, ICollection<MailAttachment>, String, String, String, String, Boolean)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, ICollection<MailAttachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
ICollection<MailAttachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, List<Attachment>, String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, List<Attachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
List<Attachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, List<Attachment>, String, String, String, String, Boolean)

Declaration
public static string SendMail(string mailFrom, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, List<Attachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
List<Attachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String[], String, String, String, String, Boolean, String)

Declaration
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, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
System.String[] attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, String[], String, String, String, String, Boolean)

Sends an email based on params.

Declaration
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)
Parameters
Type Name Description
System.String mailFrom

Email sender.

System.String mailTo

Recipients, can be more then one separated by semi-colons.

System.String cc

CC-recipients, can be more then one separated by semi-colons.

System.String bcc

BCC-recipients, can be more then one separated by semi-colons.

System.String replyTo

Reply-to email to be displayed for recipients.

MailPriority priority

MailPriority.

System.String subject

Subject of email.

MailFormat bodyFormat

MailFormat.

Encoding bodyEncoding

Email Encoding from System.Text.Encoding.

System.String body

Body of email.

System.String[] attachments

List of filenames to attach to email.

System.String smtpServer

IP or ServerName of the SMTP server. When empty or null, then it takes from the HostSettings.

System.String smtpAuthentication

SMTP authentication method. Can be "0" - anonymous, "1" - basic, "2" - NTLM. When empty or null, then it takes from the HostSettings.

System.String smtpUsername

SMTP authentication UserName. When empty or null, then it takes from the HostSettings.

System.String smtpPassword

SMTP authentication Password. When empty or null, then it takes from the HostSettings.

System.Boolean smtpEnableSSL

Enable or disable SSL.

Returns
Type Description
System.String

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

Examples
SendMail(  "admin@email.com",
                            "user@email.com",
                            "user1@email.com;user2@email.com",
                            "user3@email.com",
                            "no-reply@email.com",
                            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",
                            "admin@email.com",
                            "AdminPassword",
                            false)
| Improve this Doc View Source

SendMail(String, String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, ICollection<MailAttachment>, String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailSender, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, ICollection<MailAttachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailSender
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
ICollection<MailAttachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, ICollection<MailAttachment>, String, String, String, String, Boolean)

Declaration
public static string SendMail(string mailFrom, string mailSender, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, ICollection<MailAttachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom
System.String mailSender
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
ICollection<MailAttachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, List<Attachment>, String, String, String, String, Boolean, String)

Declaration
public static string SendMail(string mailFrom, string mailSender, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, List<Attachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL, string authProvider)
Parameters
Type Name Description
System.String mailFrom
System.String mailSender
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
List<Attachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
System.String authProvider
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, String, MailPriority, String, MailFormat, Encoding, String, List<Attachment>, String, String, String, String, Boolean)

Declaration
public static string SendMail(string mailFrom, string mailSender, string mailTo, string cc, string bcc, string replyTo, MailPriority priority, string subject, MailFormat bodyFormat, Encoding bodyEncoding, string body, List<Attachment> attachments, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword, bool smtpEnableSSL)
Parameters
Type Name Description
System.String mailFrom
System.String mailSender
System.String mailTo
System.String cc
System.String bcc
System.String replyTo
MailPriority priority
System.String subject
MailFormat bodyFormat
Encoding bodyEncoding
System.String body
List<Attachment> attachments
System.String smtpServer
System.String smtpAuthentication
System.String smtpUsername
System.String smtpPassword
System.Boolean smtpEnableSSL
Returns
Type Description
System.String
| Improve this Doc View Source

SendMail(String, String, String, String, String, String, String, String, String, String, String)

Send a simple email.

Declaration
public static string SendMail(string mailFrom, string mailTo, string bcc, string subject, string body, string attachment, string bodyType, string smtpServer, string smtpAuthentication, string smtpUsername, string smtpPassword)
Parameters
Type Name Description
System.String mailFrom

Email sender.

System.String mailTo

Recipients, can be more then one separated by semi-colons.

System.String bcc

BCC-recipients, can be more then one separated by semi-colons.

System.String subject

Subject of email.

System.String body

Body of email.

System.String attachment

A filename to attach to the email (or for no attachment).

System.String bodyType
System.String smtpServer

IP or ServerName of the SMTP server. When empty or null, then it takes from the HostSettings.

System.String smtpAuthentication

SMTP authentication method. Can be "0" - anonymous, "1" - basic, "2" - NTLM. When empty or null, then it takes from the HostSettings.

System.String smtpUsername

SMTP authentication UserName. When empty or null, then it takes from the HostSettings.

System.String smtpPassword

SMTP authentication Password. When empty or null, then it takes from the HostSettings.

Returns
Type Description
System.String

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

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS