尝试使用我的邮件ID和密码将邮件从一个通讯组列表发送到另一个通讯组列表,然后成功。但我们在show原始标签中看到(位于回复箭头附近的右上角),它会向发件人显示我的邮件ID。我需要将发件人显示为发件人分发列表,而不是显示我的邮件ID。
任何人都可以帮我解决这个问题。
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Net;
using System.IO;
using System.Threading;
namespace SendMail
{
class Program
{
static void Main(string[] args)
{
//SENDING MAIL
Console.WriteLine("*****SENDING MAIL*****");
try
{
Console.WriteLine("DL: " + rID);
string sID = "DL1@xxxxxx.com>";
string rID="DL2@xxxxxx.com>";
string senderID = "xxxx@xxxxxx.com";
string senderPassword = "xxxxxxxx";
MailMessage mail = new MailMessage();
mail.To.Add(rID);
mail.From = new MailAddress(sID);
mail.Subject = "Testing";
mail.Body = "Hi ";
mail.ReplyTo = new MailAddress(sID);
mail.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new NetworkCredential(senderID, senderPassword);
smtp.Port = 587;
smtp.EnableSsl = true;
Console.WriteLine("Sending email...");
smtp.Send(mail);
}
catch (Exception ex)
{
Console.Write("ERROR:" + ex.Message);
Console.ReadLine();
}
}
}
}