如何调试此错误 [英] how to debug this error

查看:57
本文介绍了如何调试此错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class feed_back : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            MailMessage mailmessage = new MailMessage();
            SmtpClient smtpclient = new SmtpClient("smtp.gmail.com");
           mailmessage.To.Add("[DELETED].msc@gmail.com");
           mailmessage.From = new MailAddress("[DELETED].msc@gmail.com");
            mailmessage.Subject = "Hi";
            mailmessage.Body = "Hi, Hello";
            smtpclient.Port = 587;
           
            smtpclient.Credentials = new System.Net.NetworkCredential("[DELETED].msc@gmail.com", "pswdxxxx");

            smtpclient.Send(mailmessage);
            Label5.Text = "Email sent";
             
        }
        catch (Exception ex)
        {
            Label5.Text = "Could not send email-error:" + ex.Message;

        }
    }
}



这是发送电子邮件的编码.但它仅显示此输出
"Could not send email-error:Failure sending mail."
我进行了所有的SMTP设置.请不要发送anothet编码.实际上,我已经尝试了您发送的许多编码.如果编码有任何变化,请对其进行修改.
我只有很短的时间来完成此任务.你能帮我吗?

[edit]除非您真的喜欢垃圾邮件,否则请不要在任何论坛中发布您的电子邮件地址!如果有人回复您,您将收到一封电子邮件,通知您-OriginalGriff [/edit]



This is the coding for send an email. But it displaying this output only
"Could not send email-error:Failure sending mail."
I made all the smtp settings. Please don''t send anothet codings. actually already i tried many codings you sent. Please if the coding have any changes then modify it.
I have very short time to complete this task. can you hel me?

[edit]Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know - OriginalGriff[/edit]

推荐答案

尝试smtpClient.EnableSsl = true;


这篇关于如何调试此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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