【发布时间】:2018-03-02 21:59:15
【问题描述】:
我已经通过 c# 在 asp.net 应用程序中成功发送了带有 Outlook 的约会邀请。我正在使用以下代码:
//send out the outlook notification
Outlook.Application outlookApp = new Outlook.Application();
Outlook.AppointmentItem newMeeting = outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem) as Outlook.AppointmentItem;
if (newMeeting != null)
{
newMeeting.MeetingStatus = Microsoft.Office.Interop.Outlook.OlMeetingStatus.olMeeting;
newMeeting.Location = "TBD";
newMeeting.Subject = "New SEB Consult";
newMeeting.Body = "A new meeting has been scheduled. If you're a member of the team, please accept";
newMeeting.Start = meetingDate;
newMeeting.Duration = 60;
Outlook.Recipient recipient = newMeeting.Recipients.Add("Smith John");
recipient.Type = (int)Outlook.OlMeetingRecipientType.olRequired;
((Outlook._AppointmentItem)newMeeting).Send();
}
这可行,但我的问题是它是从我在同一台计算机上使用 Outlook 登录的电子邮件发送的。我想从不同的电子邮件发送它们,这样它们看起来更像是来自我的应用程序的系统通知,而不是个人电子邮件。我确实有该帐户的用户名和密码,但该应用程序最终将在远程服务器上运行,因此我不能只使用另一封电子邮件登录 Outlook。我找不到任何改变发件人的东西。有没有人有更多关于如何更改这些凭据或在哪里查找凭据的信息?
【问题讨论】:
-
这个主题可以帮助你实现你想要的。 Send e-mail via SMTP using C#