发送到电子邮件接触形式asp.net [英] sending to an email with contact form asp.net

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

问题描述

我将如何去用asp.net接触形式发送电子邮件到指定的电子邮件地址?该网站托管虽然托管公司。谢谢


解决方案

 邮件MAILMESSAGE新= MAILMESSAGE();
SmtpClient SMTPSERVER =新SmtpClient(your.mail.server);mail.From =新的MailAddress(your_email_address@gmail.com);
mail.To.Add(to_address@mfc.com);
mail.Subject =测试邮件;
mail.Body =这是测试SMTP邮件;SmtpServer.Credentials =新System.Net.NetworkCredential(用户名,密码);SmtpServer.Send(邮件);

How would I go about sending an email to a specified email address with a contact form in asp.net? The website is hosted though a hosting company. thanks

解决方案

MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("your.mail.server");

mail.From = new MailAddress("your_email_address@gmail.com");
mail.To.Add("to_address@mfc.com");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail";

SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");

SmtpServer.Send(mail);

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

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