反馈表不起作用 [英] feedback form is not working

查看:98
本文介绍了反馈表不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经从这一侧复制了反馈表单,该表单正在运行,但是邮件没有发送,并且显示发送电子邮件失败指定的字符串不是电子邮件地址所需的格式".请提供解决方案...


I have copy feedback form from this side it is running but mail is not going and it is giving"Send Email FailedThe specified string is not in the form required for an e-mail address".please give the solution of it...

using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net.Mail;

public partial class _Default : System.Web.UI.Page
{
    protected void btnSendmail_Click(object sender, EventArgs e)
    {
        SmtpClient smtpClient = new SmtpClient();
        MailMessage message = new MailMessage();
        try
        {
            MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);
            smtpClient.Host = "localhost";
            smtpClient.Port = 25;
            message.From = fromAddress;
            message.To.Add("teddy.shally@gmail.com");
            message.Subject = "Feedback";
            message.CC.Add("teddy.shally@gmail.com");
            message.CC.Add("agarwal.neha.0703@gmail.com.com");
            message.Bcc.Add(new MailAddress("tushargupta251@gmail.com."));
            message.Bcc.Add(new MailAddress("admin4@yoursite.com"));
            message.IsBodyHtml = false;
            message.Body = txtMessage.Text;
            smtpClient.Send(message);
            lblStatus.Text = "Email successfully sent.";
        }
        catch (Exception ex)
        {
            lblStatus.Text = "Send Email Failed" + ex.Message;
        }
    }
    
    protected void btnReset_Click(object sender, EventArgs e)
    {
      txtName.Text = "";
      txtMessage.Text = "";
      txtEmail.Text = "";
    }
}

推荐答案

其中一个电子邮件ID的格式错误.其中有两个com.
The format for one of your email ids is wrong. There are two coms in it.


要通过您的应用发送邮件,请检查此链接,它将完全帮助您...

http://myashkap.wordpress.com/ [ ^ ]
for sending mail through your appication check this link it will definetly help you...

http://myashkap.wordpress.com/[^]


这篇关于反馈表不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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