我是通过网站发送社交邮件,我想通过候选人名称发送邮件任何人都可以帮助我吗? [英] I Am Sending Social Mail By Website, I Want Send Mail By Candidate Name Anyone Can Help Me?
本文介绍了我是通过网站发送社交邮件,我想通过候选人名称发送邮件任何人都可以帮助我吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的(候选人姓名),
这是自动邮件我们会尽快回复你。
问候
ABC
Dear (candidate name),
this is automail we will get back to you soon.
Regards
ABC
推荐答案
为MailBody定义一个常量字符串
Define a constant string for MailBody
public static string MailBody = "Dear [CandidateName], this is automail we will get back to you soon. Regards ABC"
制作一个替换方法邮件正文中的候选名称
Make a method to replace the candiate name in mail body
public string FormatMailBody(string candidateName)
{
return this.MailBody.Replace("[CandidateName]",candidateName);
}
在字符串中调用此方法以获取自定义邮件正文并通过邮件发送该字符串。
call this method in a string to get the customized mail body and send that string in mail.
MailMessage message = new MailMessage(from, to);
message.Subject = "Using the new SMTP client.";
message.Body = FormatMailBody(candidateName);
SmtpClient client = new SmtpClient(server);
client.UseDefaultCredentials = true;
try {
client.Send(message);
}
catch (Exception) {
}
这篇关于我是通过网站发送社交邮件,我想通过候选人名称发送邮件任何人都可以帮助我吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文