MailMill .NET Class Library

Mail.Send Method 

Sends the current message

public void Send();

Remarks

The From property and at least one the Bccs, Ccs or Tos properties must be set before sending the message or an error will occur.

Exceptions

Exception Type Condition
ArgumentNullException path is a null reference (Nothing in Visual Basic).
MailMillException Some message headers were not properly set
-or-
you try to sign or encrypt the message and CAPICOM 2.0 is not installed
-or-
you try to sign the message and the sender certificate was not found
-or-
you try to encrypt the message a receiver certificate was not found
COMException An error occured while signing or encrypting a message.
ArgumentOutOfRangeException the server port is not between MinPort and MaxPort.
SocketException An error occurred when accessing the socket.
IOException There is a failure while writing to the network.

Example

This sample shows how to send a basic text plain message.

Mail oMail = new Mail();
oMail.From = "Sender <sender@emilltest.com>";
oMail.Tos.Value = "Receiver <receiver@emilltest.com>";
oMail.Subject = "Test message";
oMail.TextBody = "This is a test message"; 
oMail.Server = "server.mydomain.tld";
oMail.Send(); 

See Also

Mail Class | MailMill Namespace | From | Tos | Ccs | Bccs