SSIS 发送邮件任务 - 超链接重命名
SSIS Send Mail Task - Hyperlink rename
我有一个通过 Send Mail Task
发送电子邮件的 SSIS 包 邮件正文包含以下消息:
查看 URL https://....... 查看结果
我可以编辑超链接吗?
邮件正文应该说:
查看“嵌入式 Link”结果!
与我的许多答案一样,我更喜欢脚本任务,因为我认为它可以让您更好地控制。以下是发送邮件的入门...
using (MailMessage mail = new MailMessage())
{
SmtpClient SmtpServer = new SmtpClient("your mail client");
mail.From = new MailAddress("email sending from");
mail.To.Add(new MailAddress("email where it goes"));
mail.Subject = "subject";
mail.ReplyToList.Add("email where replies go");
mail.IsBodyHtml = true; //this is important for creating hyperlinks
mail.Body = "<p>See <a href = 'www.whereever.com'>"Embedded Link"</a> for results!</p>";
//Note html allows for either double or single quotes. I chose single because c# uses double.
mail.Bcc.Add("bcc email");
SmtpServer.Port = ####;
SmtpServer.Credentials = new NetworkCredential(from, pword);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
我们发送了很多电子邮件,我将其作为一个单独的包,您可以在其中传递 ToList、CcList、BccList、主题和正文的参数。您显然需要调整代码以使用 foreach 处理该问题,但我在此答案中将其保持简单。
我有一个通过 Send Mail Task
发送电子邮件的 SSIS 包 邮件正文包含以下消息:
查看 URL https://....... 查看结果
我可以编辑超链接吗?
邮件正文应该说:
查看“嵌入式 Link”结果!
与我的许多答案一样,我更喜欢脚本任务,因为我认为它可以让您更好地控制。以下是发送邮件的入门...
using (MailMessage mail = new MailMessage())
{
SmtpClient SmtpServer = new SmtpClient("your mail client");
mail.From = new MailAddress("email sending from");
mail.To.Add(new MailAddress("email where it goes"));
mail.Subject = "subject";
mail.ReplyToList.Add("email where replies go");
mail.IsBodyHtml = true; //this is important for creating hyperlinks
mail.Body = "<p>See <a href = 'www.whereever.com'>"Embedded Link"</a> for results!</p>";
//Note html allows for either double or single quotes. I chose single because c# uses double.
mail.Bcc.Add("bcc email");
SmtpServer.Port = ####;
SmtpServer.Credentials = new NetworkCredential(from, pword);
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
}
我们发送了很多电子邮件,我将其作为一个单独的包,您可以在其中传递 ToList、CcList、BccList、主题和正文的参数。您显然需要调整代码以使用 foreach 处理该问题,但我在此答案中将其保持简单。