我似乎不明白。我可以创建一些代码来发送这样的电子邮件:
String userName = "user@domain.com";
String password = "your password";
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("ToAddress"));
msg.From = new MailAddress(userName);
msg.Subject = "Test Office 365 Account";
msg.Body = "Testing email using Office 365 account.";
msg.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Host = "smtp.office365.com";
client.Credentials = new System.Net.NetworkCredential(userName, password);
client.Port = 587;
client.EnableSsl = true;
client.Send(msg);
或者我可以在我们的 Azure AD 中创建一个应用程序并设置权限并使用 GRAPH API 发送电子邮件,对吗?
是否有任何可能的原因我想使用 GRAPH API 来执行此操作?