Cloud
Облачный сервис для быстрого и эффективного анализа и визуализации данных для вашего бизнеса без необходимости создания своих приложений и программирования.
Sending a Form by Email/Program.cs creates the message and attaches the in-memory PDF before sending it:static Hashtable Recipients = new Hashtable()
{
["Alex@gmail.com"] = "Alex",
["Tom@gmail.com"] = "Tom",
// ...more recipients
};
var smtpClient = new SmtpClient("smtp.gmail.com")
{
Port = 587,
Credentials = new NetworkCredential("username", "password"),
EnableSsl = true,
};
var form = new StiForm();
form.Load(@"Data\CustomerSatisfactionSurvey.mrt");
var label = form.GetElementByName("RecipientLabel") as StiLabelElement;
var settings = new StiPdfExporterSettings { UsePdfA = false, ReadOnly = false };
var pdfExporter = new StiPdfExporter(settings);
foreach (string mail in Recipients.Keys)
{
label.Text.Expression = $"Hello, {Recipients[mail]}";
var pdf = pdfExporter.ExportForm(form);
var mailMessage = new MailMessage
{
From = new MailAddress("mail@gmail.com"),
Subject = "subject",
Body = "<h1>Hello</h1>",
IsBodyHtml = true,
};
mailMessage.To.Add(mail);
mailMessage.Attachments.Add(new Attachment(new MemoryStream(pdf), MediaTypeNames.Application.Pdf));
smtpClient.Send(mailMessage);
}