我正在创建简单的电子邮件发送应用程序.在我的应用程序中,当我发送电子邮件时,我必须输入我的电子邮件地址或密码,但我不想使用密码,只想输入电子邮件
i am creating simple email sending application. In my application when ever i send email i have to put my email address or password as from but i don't want to use password only want to put email
所以
我可以使用 c#/.net 应用程序在不使用密码的情况下发送电子邮件吗?
Can i send Email without using password using c#/.net application ?
这是我的代码:
try
{
// setup mail message
MailMessage message = new MailMessage();
message.From = new MailAddress(textBox1.Text);
message.To.Add(new MailAddress(textBox2.Text));
message.Subject = textBox3.Text;
message.Body = richTextBox1.Text;
// setup mail client
SmtpClient mailClient = new SmtpClient("smtp.gmail.com");
mailClient.Credentials = new NetworkCredential(textBox1.Text,"password");
// send message
mailClient.Send(message);
MessageBox.Show("Sent");
}
catch(Exception)
{
MessageBox.Show("Error");
}
我可以使用 c#/.net 应用程序在不使用密码的情况下发送电子邮件吗?
Can i send Email without using password using c#/.net application ?
是的,如果您可以访问不需要身份验证的电子邮件网关,您可以这样做:
Yes, if you have access to an email gateway that doesn't require authentication you can simply do:
SmtpClient mailClient = new SmtpClient("your.emailgateway.com");
mailClient.Send(message);
也许您的公司或 ISP 可以为您提供一个?
Maybe your company or ISP can provide one for you?
这篇关于我可以在不通过 SMTP 服务器验证的情况下发送电子邮件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!