SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
//Specify your mail user name
client.Username = "email@example.com";
//Specify your mail password
client.Password = "password";
//Specify your Port #
client.Port = 587;
client.SecurityOptions = SecurityOptions.SSLExplicit;
static void Email_Test()
//Create SmtpClient as client and specify server, port, user name and password
SmtpClient client = GetSmtpClient();
//Create instances of MailMessage class
//Specify To, From, Subject and Message
MailMessage msg1 = new MailMessage("firstname.lastname@example.org", "email@example.com", "Subject1", "message1, how are you?");
MailMessage msg2 = new MailMessage("firstname.lastname@example.org", "email@example.com", "Subject2", "message2, how are you?");
MailMessage msg3 = new MailMessage("firstname.lastname@example.org", "email@example.com", "Subject3", "message3, how are you?");
//you can create as many instances of MailMessage class as you like.
//Create an instance of MailMessageCollection class
MailMessageCollection manyMsg = new MailMessageCollection();
//Use client.BulkSend function to complete the bulk send task
//Send Message using BulkSend method
//Display ‘Message Sent’, only if message sent successfully
catch (Exception ex)
Console.WriteLine("Press enter to quit");
all mails are going in spam folder? is there any solution ?
It depends on rules set on recipient server and it is not in the control of Aspose.Email while sending the mail. If you are using exchange server, you may please visit Manage Rules on Exchange Server to set Inbox rules. However this is to be set on the recipient server if access is available. You may please contact the mail server to configure the server as per the requirement.
Should you have any other query related to Aspose.Email, feel free to write us back here.