Free Support Forum - aspose.com

Need Sample For Auto Schedule Mass emails Daily on a Specified Time

I am looking for Sample code For Auto Schedule Mass emails Daily on a Specified Time

Thanks

corpimg

Hi corpimg,


Thank you for considering Aspose.Email.

From you post, I guess you want some functionality like “Do not deliver before” option provided by MS Outlook. If I have correctly understood this, I am afraid to inform that such facility isn’t supported at present by Aspsoe.Email API. However, I am currently carrying out a work around method to test if this can be carried out that way, and will soon update you about my findings.

Hi,


I have tried to Auto-schedule Mass emails using another option of the API, but I am afraid to inform that this is not supported by the API, and you will have to achieve this by manually setting the time in your application. Once your application detects that its time to send emails, you can use the Bulk Message sending facility to send Mass emails within short time using your favourite SMTP client. Please refer to the following code for your reference to send bulk emails using Aspose.Email API.

//Create SmtpClient as client and
specify server, port, user name and password
<o:p></o:p>

SmtpClient client = new SmtpClient("smtp.gmail.com", 587, "username", "password");

client.EnableSsl = true;

client.SecurityMode = SmtpSslSecurityMode.Explicit;

//Create instances of MailMessage class

//Specify To, From, Subject and Message

MailMessage msg1 = new MailMessage("from@gmail.com", " to1@xyz.com", "Subject1", "message1 Body");

MailMessage msg2 = new MailMessage("from @gmail.com", " to2@xyz.com", "Subject2", "message2,Body");

MailMessage msg3 = new MailMessage("from @gmail.com", " to3@xyz.com", "Subject3", "message3,Body");

//you can create as many instances of MailMessage class as you like.

//Create an instance of MailMessageCollection class

MailMessageCollection manyMsg = new MailMessageCollection();

manyMsg.Add(msg1);

manyMsg.Add(msg2);

manyMsg.Add(msg3);

//Use client.BulkSend function to complete the bulk send task

try

{

//Send Message using BulkSend method

client.BulkSend(manyMsg);

//Display ‘Message Sent’, only if message sent successfully

Console.WriteLine("Message sent");

}

catch (Exception ex)

{

System.Diagnostics.Trace.WriteLine(ex.ToString());

}