gpt4 book ai didi

C# - 从 BlueHost 发送电子邮件

转载 作者:太空宇宙 更新时间:2023-11-03 16:32:06 25 4
gpt4 key购买 nike

我有 BlueHost,但我无法让它与 C# 一起工作。我已经从我登录的页面上删除了详细信息:

enter image description here

然后我使用此代码尝试发送电子邮件:

MailMessage message = new MailMessage
{
From = new MailAddress("toEmail@site.com", "toEmail@site.com")
};
message.IsBodyHtml = false;
message.To.Add("email@site.com");
message.Subject = "my subject";
message.Body = "body";
message.Priority = MailPriority.Normal;
SmtpClient client = new SmtpClient
{
Port = 465,
Host = "box263.bluehost.com",
EnableSsl = true,
Credentials = new NetworkCredential("myEmail@site.com", "myPassword"),
Timeout = 10000,
UseDefaultCredentials = false
};
client.Send(message);

即使它有足够的时间(10 秒),它也会抛出一个超时错误。即使我不设置超时时间,它也只是静置一会儿。我也尝试过不使用 SSL,禁用“EnableSsl”,将端口更改为“26”,并将主机更改为“mail.embirk.com”,但这也不起作用。此外,这确实适用于 Microsoft Outlook 等第三方软件。有任何想法吗?谢谢。

编辑:我还联系了 Bluehost 的二级支持技术人员,他们说他们也被难住了。他们说他们用 Thunderbird 试过了,一切正常。他们说可能是要找证书?

编辑 2:

这个 Outlook 注册表有帮助吗? (如果运行,这适用于 Outlook)。

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\OMI Account Manager\Accounts\steve@embirk.com]
"DCEmail"=dword:00000002
"IMAP Server"="box263.bluehost.com"
"IMAP Port"=dword:000003e1
"SMTP Server"="box263.bluehost.com"
"SMTP Port"=dword:000001d1
"Connection Type"=dword:00000003
"IMAP User Name"="steve@embirk.com"
"SMTP Display Name"="steve@embirk.com"
"SMTP Email Address"="steve@embirk.com"
"SMTP Reply To Email Address"="steve@embirk.com"
"SMTP Organization Name"=""
"Account Name"="steve@embirk.com"
"IMAP Timeout"=dword:0000003c
"SMTP Timeout"=dword:0000003c
"IMAP Secure Connection"=dword:00000001
"IMAP Skip Account"=dword:00000000
"IMAP Prompt for Password"=dword:00000001
"SMTP User Name"="steve@embirk.com"
"SMTP Use Sicily"=dword:00000002
"SMTP Secure Connection"=dword:00000001
"SMTP Split Messages"=dword:00000000
"SMTP Prompt for Password"=dword:00000000
"IMAP Root Folder"=""
"IMAP Polling"=dword:00000001
"IMAP Poll All Folders"=dword:00000001
"IMAP Dirty"=dword:00000000

最佳答案

我会尝试在客户端 block 之外声明凭据并将其分配给客户端凭据。

实际上完全摆脱了障碍。

NetworkCredential myCred = new NetworkCredential("xxxxxxxx", "xxxxxxxx");


client.Credentials = myCred;
client.port = 465,
client.Host = "box263.bluehost.com",
client.EnableSsl = true,
client.Credentials = new NetworkCredential("myEmail@site.com", "myPassword"),
client.Timeout = 10000,
client.UseDefaultCredentials = false

关于C# - 从 BlueHost 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10487937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com