public static void SendTemplate()
{
// 1) Required values
string username = "<your_username>";
string password = "<your_password>";
string clientid = "<your_clientid>";
string clientsecret = "<your_clientsecret>";
string smtpplus_username = "<your_smtpplus_username>";
string smtpplus_password = "<your_smtpplus_password>";
// 2) Setup the MailUp Client:
MailUpClient client = new MailUpClient(clientid, clientsecret);
client.RetrieveAccessToken( username, password );
// 3) prepare the input:
TemplateDTO msg = new TemplateDTO()
{
TemplateId = 694,
Subject = "Test message from template",
From = new EmailAddressDTO() { Name = "Test User", Email = "test@mailup.it" },
To = new List<EmailAddressDTO>() { new EmailAddressDTO() { Name = "Massimo", Email = "info@mailup.it" } },
Cc = new List<EmailAddressDTO>(),
Bcc = new List<EmailAddressDTO>(),
ReplyTo = null,
CharSet = "utf-8",
ExtendedHeaders = null,
Attachments = null,
EmbeddedImages = new List<MessagePartDTO>() {
new MessagePartDTO() {
Filename = "Image.jpg",
ContentId = "img001",
Body = new byte[] { 0x01, 0x02, 0x03, 0x04 }
}
},
XSmtpAPI = null,
User = new SmtpUserDTO() { Username = smtpplus_username, Secret = smtpplus_password }
};
// 4) Invoke the web method:
SendResponseDTO result = null;
try
{
result = client.SendTemplate(msg);
}
catch (Exception ex)
{
Console.WriteLine("Cannot perform the operation due to " + ex.Message);
return;
}
// 5) Print results:
if (result != null)
Console.WriteLine("Result of sending task:" + result.Message);
else
Console.WriteLine("An error occurred while sending template.");
}
public static void SendTemplate()
{
// 1) Required values
string username = "<your_username>";
string password = "<your_password>";
string clientid = "<your_clientid>";
string clientsecret = "<your_clientsecret>";
string smtpplus_username = "<your_smtpplus_username>";
string smtpplus_password = "<your_smtpplus_password>";
// 2) Setup the MailUp Client:
MailUpClient client = new MailUpClient(clientid, clientsecret);
client.RetrieveAccessToken( username, password );
// 3) prepare the input:
TemplateDTO msg = new TemplateDTO()
{
TemplateId = 694,
Subject = "Test message from template",
From = new EmailAddressDTO() { Name = "Test User", Email = "test@mailup.it" },
To = new List<EmailAddressDTO>() { new EmailAddressDTO() { Name = "Massimo", Email = "info@mailup.it" } },
Cc = new List<EmailAddressDTO>(),
Bcc = new List<EmailAddressDTO>(),
ReplyTo = null,
CharSet = "utf-8",
ExtendedHeaders = null,
Attachments = null,
EmbeddedImages = new List<MessagePartDTO>() {
new MessagePartDTO() {
Filename = "Image.jpg",
ContentId = "img001",
Body = new byte[] { 0x01, 0x02, 0x03, 0x04 }
}
},
XSmtpAPI = null,
User = new SmtpUserDTO() { Username = smtpplus_username, Secret = smtpplus_password }
};
// 4) Invoke the web method:
SendResponseDTO result = null;
try
{
result = client.SendTemplate(msg);
}
catch (Exception ex)
{
Console.WriteLine("Cannot perform the operation due to " + ex.Message);
return;
}
// 5) Print results:
if (result != null)
Console.WriteLine("Result of sending task:" + result.Message);
else
Console.WriteLine("An error occurred while sending template.");
}