从字段中获取任何邮件ID [英] take any mail id in from field

查看:81
本文介绍了从字段中获取任何邮件ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码发送邮件,这工作正常但我的问题是,当我使用此代码接收邮件时,我从字段中收到身份验证邮件ID,

但我想要,我在字段中使用任何邮件ID,所以我回复esily上的邮件ID,

PLZ帮我,我尝试了很多代码,但都用得少



 使用 System.Net.Mail; 

private void MailSend()
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient( smtp .gmail.com);
SmtpServer.Host = smtp.gmail.com;

mail.From = new MailAddress( FromMailName@gamil.com);
mail.To.Add( ToMailName@gmail.com);
mail.Subject = 测试邮件;
mail.Body = 这是用于测试来自GMAIL的SMTP邮件;

SmtpServer.Port = 587 ;

SmtpServer.Credentials = new System.Net.NetworkCredential( ToMailName@gmail.com 123456 ); // 用户邮件名称和邮件密码
SmtpServer.EnableSsl = ;

SmtpServer.Send(mail);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

解决方案

GMail只允许您从登录的人发送邮件。这样你无法从他们的服务器发送垃圾邮件。



您必须站起来自己的SMTP服务器或找到允许您代表发送邮件的其他服务器其他人。



您可以尝试添加:



邮件。 ReplyTo =   replytome@gmail.com; 





注意:对于ReplyToList方法,不推荐使用该方法,请使用您喜欢的方法。



看看他们是否允许。


i am use this code for sending mail, which is work fine but my problem is, when i receive mail using this code, i receive authentication mail id in from field,
but i want that, i use any mail id in from field so i reply esily on that mail id,
plz help me i try many code but all are use less

using System.Net.Mail;
 
 private void MailSend()
        {
            try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");  
                SmtpServer.Host = "smtp.gmail.com";
 
                mail.From = new MailAddress("FromMailName@gamil.com");
                mail.To.Add("ToMailName@gmail.com");
                mail.Subject = "Test Mail";
                mail.Body = "This is for testing SMTP mail from GMAIL";
 
                SmtpServer.Port = 587;
 
                SmtpServer.Credentials = new System.Net.NetworkCredential("ToMailName@gmail.com", "123456"); // User Mail Name And Mail Password
                SmtpServer.EnableSsl = true;
 
                SmtpServer.Send(mail);              
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

解决方案

GMail only allows you to send mail from whoever is logged in. That way you can''t send spam from their servers.

You''ll have to stand up your own SMTP server or find another server that allows you to send mail on behalf of others.

You can try adding:

mail.ReplyTo = "replytome@gmail.com";



Note: That method is deprecated for the ReplyToList method, use whichever you prefer.

See if they allow that.


这篇关于从字段中获取任何邮件ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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