发送收件箱中找不到的邮件 [英] sending mail not found in inbox

查看:96
本文介绍了发送收件箱中找不到的邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的编码是:
显示邮件已成功发送,但在邮箱中找不到邮件.
请帮忙.

My coding is that:
that show mail send successfully but mail not found in mailbox .
Please help.

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

    protected void Button1_Click(object sender, EventArgs e)
    {
        SmtpClient smtp = new SmtpClient();
        MailMessage message = new MailMessage();
        message.To.Add(new MailAddress ("uamrit26@yahoo.in"));
        message.IsBodyHtml = true;
        message.Body = "<html><head><body><p> this is for you ye form se beja he </p></body></head></html>";
        message.Subject=("response from the web sitre");
        message.From = new MailAddress("uamrit@gmail.com");
       
        try
        {
            smtp.Send(message);
            Response.Write("Your Email has been sent sucessfully -");
        }
        catch (Exception exc)
        {
            Response.Write("Send failure: " + exc.ToString());
        }
    }
}



在web.config



in web.config

<system.net>
    <mailsettings>
        <smtp from "uamrit@gmail.com">
        <network host="192.168.1.2" port="25" username="uamrit" password="*****" />
    </mailsettings>
</system.net>



请告诉我我该怎么做?



Please tell me how can I do this?

推荐答案

那是因为您必须检查服务器是否收到对邮件尝试的响应.您可以通过从服务器获取实际发送原始电子邮件的帐户的新邮件来完成此操作.

这种方法的问题在于,可能需要几天的时间才能收到拒绝电子邮件.

我还将整个SMTP代码块放在try/catch块中(在Button1_Click方法中).

That''s because you have to check the server for a response to your mail attempt. You do this by getting new mail from the server for the account that actually sent the original email message.

The problem with this approach is that it might take DAYS to get the rejection email.

I would also put the entire block of SMTP code in the try/catch block (in the Button1_Click method).


必须使用
smtp.Authenticate(用户名,密码)
发件人的用户名和密码.
Must use
smtp.Authenticate(username, password)
Username and password of sender.


使用

Use

smtp.Authenticate(username, password)




正如Ognjen2所说.那么它只会起作用.




as Ognjen2 said. then only it will work.


这篇关于发送收件箱中找不到的邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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