是否可以通过C#中的昵称从Google Apps发送电子邮件

时间:2013-01-15 01:27:41

标签: c# google-apps

我有一个标准的Google Apps帐户,他们会为我托管我的电子邮件..

目前我可以使用C#代码发送电子邮件,但它们总是来自我的主电子邮件地址..我设置了几个昵称......在Gmail界面中,可以按照这里的说法进行操作:Google Apps - Send email from a nickname

但是我想从代码中做到这一点..所以我可以发送电子邮件为“info @”或“support @”... 我有一个名为“EmailFrom”的appSetting,定义为“info @”......

MailMessage mm = new MailMessage(ConfigurationManager.AppSettings["EmailFrom"], ToAddress);

//'(2) Assign the MailMessage's properties
mm.Subject = Subject;
mm.Body = MessageBody;
mm.IsBodyHtml = true;

//'(3) Create the SmtpClient object
SmtpClient smtp = new SmtpClient();

smtp.Port = System.Convert.ToInt32(ConfigurationManager.AppSettings["smtpPort"]);
smtp.EnableSsl = true;

smtp.Send(mm);

这可能吗?

1 个答案:

答案 0 :(得分:0)

确定..

想出来......

似乎我需要在gmail界面中添加电子邮件地址... 选择“设置”菜单,然后选择“帐户...”,然后选择“添加您拥有的其他电子邮件地址”。 我刚刚完成了验证过程,添加了我想发送的昵称..

容易..