如何从网站发送邮件? [英] How to send a mail from website?

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

问题描述

海,

在我的网站上,我有一个enquiury表单.如果键入enqiury声明,然后单击提交"按钮,则该声明将发送到我的邮件ID.我怎样才能做到这一点 ?请帮我.

谢谢..

Hai,

In my website i have a enqiury form.if the enqiury statement are typed and click the submit button the statement are sent to my mail id . How can i do this ? plz help me.

Thanks..

推荐答案

这很简单,并且在网络上广泛记录,您看上去如何?复制这些年来您可以从数百个Web帖子中获得的代码,更改邮件服务器代码以匹配您的邮件服务器,您就完成了.
This is trivial and widely documented on the web, did you look ? Copy the code you can get from 100s of web posts over the years, change the mail server code to match your mail server, and you''re done.


检查以下代码
check the following code
 var mail = new MailMessage();
mail.From = new MailAddress("your email address");
mail.To.Add(strItem);

mail.Subject = "Edu-Kinect Event Information";
mail.IsBodyHtml = true;
mail.Body = "your comments";
var mailClient = new SmtpClient("smtp.gmail.com", 587);
mailClient.EnableSsl = true;
mailClient.Credentials = new System.Net.NetworkCredential("your email address", "your password");
mailClient.Send(mail);


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

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