关于从asp.net发送邮件 [英] About sending mail from asp.net

查看:57
本文介绍了关于从asp.net发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

海,

我要发送并使用asp.net从我们公司的站点接收邮件.从gmail发送邮件有效,但我不知道如何从我的网站发送邮件以及必须提供哪些详细信息.

I want send  and receive mails using asp.net from our company site. Sending from gmail is working, but i don't know how to send from my site and which details i have to give .

MailMessage 消息= MailMessage ();

MailMessage message = new MailMessage ();

message.From = 邮件地址("sender@foo.bar.com" ; );

message.From = new MailAddress ("sender@foo.bar.com" );

 

message.To.Add( 邮件地址(" recipient1@foo.bar.com" )));

message.To.Add(new MailAddress ("recipient1@foo.bar.com" ));

message.To.Add( 邮件地址(" recipient2@foo.bar.com" )));

message.To.Add(new MailAddress ("recipient2@foo.bar.com" ));

message.To.Add( 邮件地址(" recipient3@foo.bar.com" )));

message.To.Add(new MailAddress ("recipient3@foo.bar.com" ));

 

message.CC.Add( 邮件地址(" carboncopy@foo.bar.com" )));

message.CC.Add(new MailAddress ("carboncopy@foo.bar.com" ));

message.Subject = 这是我的主题" ;

message.Subject = "This is my subject" ;

message.Body = 这是内容" ;

message.Body = "This is the content" ;

 

SmtpClient 客户端= SmtpClient ();

SmtpClient client = new SmtpClient ();

client.Send(message);

< system.net >

< system.net >

    < mailSettings >

      < smtp 来自 = " test@foo.com " >

      < smtp from = "test@foo.com ">

        ; < 网络 主机 = " smtpserver1 " 端口 = " 25 " 用户名 = " 用户名" 密码 = " 秘密" 默认凭据 = " true " />

        < network host = "smtpserver1 " port = "25 " userName = "username " password = "secret " defaultCredentials = "true " />

      </ smtp >

    </ mailSettings >

  </ system.net >

  </ system.net >

在此示例中,主机,smtp来自,端口,usernsme是什么,密码?

 

如何提供我想知道的详细信息.

 

请给我有关此方面的详细信息.

 

感谢

Thanq

推荐答案

Indira,

Hi Indira,

  感谢您的发帖!我建议发布 您在一个MS论坛

 Thank you for your post!  I would suggest posting your question in one of the MS Forum

首页 ASP.NET论坛
Home ASP.NET Forums General ASP.NET Getting Started


这篇关于关于从asp.net发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆