如何从主机获取SmtpClient [英] how to get SmtpClient from my host
本文介绍了如何从主机获取SmtpClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好:)
我正在尝试从网页中学习电子邮件电子邮件
但我不知道如何在这里获取主机值:smtpClient(string host);
例如,我有一个域名为"something.net"的主机,我应该在上面设置什么值?
我尝试设置主机的相同名称"something.net",但没有起作用:(
这是我的代码
hi all :)
I''m trying to learn sinding emails from web page
but I don''t know how to get host value here : smtpClient(string host);
I have a host with domain name "something.net" for example, what value should I set above ?
I tries to set the same name of my host " something.net ", but didn''t work :(
here is my code
protected void Button1_Click(object sender, System.EventArgs e)
{
try
{
MailMessage message = new MailMessage("something1@live.com", "something2@live.com", "hi", "hi hi hi");
SmtpClient emailClient = new SmtpClient("I dont know what I have to put here");
emailClient.Send(message);
Label1.Text = "Message Sent";
}
catch (Exception ex)
{
Label1.Text = ex.ToString();
}
}
谢谢大家:)
thank you all :)
推荐答案
您将邮件服务器地址放在此处,如mail.domain.com
参见此处: http://social.msdn.microsoft.com /Forums/en/csharpgeneral/thread/d2217c49-e5de-430a-9a86-fd2767743ad1 [
You put the mail servers address there likemail.domain.com
See here : http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/d2217c49-e5de-430a-9a86-fd2767743ad1[^]
这篇关于如何从主机获取SmtpClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文