反馈形式不起作用 [英] feedback formis not working

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

问题描述


我已经从您的网站上复制了一个代码.但是它无法正常工作并出现错误.代码是

Hi,
I have copy a code from your website .But it is not working andgiving a error. the code is

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 = "";
          }



错误是
说明:编译服务该请求所需的资源期间发生错误.请查看以下特定的错误详细信息,并适当修改您的源代码.
编译器错误消息:CS1513:}预期
源错误:



the error is
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1513: } expected
Source Error:

Line 45:         {<br />
Line 46:             lblStatus.Text = "Send Email Failed" + ex.Message;<br />
Line 47:         }<br />
Line 48:     <br />
Line 49:          protected void btnReset_Click(object sender, EventArgs e)



请解决我的问题



please solve my problem

推荐答案

此方法缺少右括号.只需放它(}),就可以了:
This method has a missing closing bracket. Just put it(}) and it should be good to go:
protected void btnSendmail_Click(object sender, EventArgs e)


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

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