关于通过SMTP发送邮件 [英] About Sending mail through SMTP

查看:171
本文介绍了关于通过SMTP发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


如果 SMTP USERNAME & 从地址不同吗?

例如;

Hi,
Is this possible to send a mail if SMTP USERNAME & FROM ADDRESSES are different ?

For example ;

message.From = new MailAddress("bbbb@mydomain.com");
            message.To.Add(new MailAddress(to));
            message.CC.Add(new MailAddress(cc));
            message.Bcc.Add(new MailAddress(bcc));
            message.Subject = subject;
            message.Body = body;
            message.IsBodyHtml = true;
            
            SmtpClient mailClient = new SmtpClient("mydomain");
            mailClient.EnableSsl = true;
            mailClient.Port = Convert.ToInt32(objSettings.Port);
            mailClient.UseDefaultCredentials = true;
            mailClient.Credentials = new NetworkCredential("aaaa@mydomain.com", "password");




在这里,我从地址指定为"bbbb@mydomain.com",smtp用户名为"aaaa@mydomain.com".但是,即使我将发件人"地址设置为"bbbb@mydomain.com",我仍从"aaaa@mydomain.com"接收邮件.

如何从带有diff smtp用户名的发件人"(自定义地址,将动态更改)地址中获取邮件?

请回复,




Here i specified from address as "bbbb@mydomain.com" and smtp username is "aaaa@mydomain.com". But I''m getting mail from "aaaa@mydomain.com" even though I was set "From" address as "bbbb@mydomain.com".

How will I get mail from my "From" (custom address , will change dynamically) address with diff smtp username ?

Please Reply,

推荐答案

当然可以,因为发件人"地址与SMTP服务器的身份验证无关.
请参阅以下代码示例: http://codesnippets.joyent.com/posts/show/1362 [ ^ ].
而且,正式地,在哪里获取邮件"都没有关系.这是一项不同的服务,可以由同一软件实施,但可以具有不同的URL,身份验证;并且使用了不同的协议(在您的情况下是什么-POP3?–没关系……).


—SA
Of course this is possible, as "From" address has nothing to do with your authentication with SMTP server.
Please see this code sample: http://codesnippets.joyent.com/posts/show/1362[^].
Moreover, formally, it does not matter where you are "getting mail". This is a different service which can be implemented by the same software but can have different URL, authentication; and a different protocol is used (what is it in your case — POP3? — does not really matter…).


—SA


如果我已经在我的邮件帐户中进行了身份验证,则可以更改发件人的发件人地址
例如
如果在这种情况下,我从帐户设置中为不同的来自ID"配置了我的gmail帐户,则可以更改..
From Address can be changed if i have authenticated it in my mail account
Ex.
If i have configured my gmail account from settings of account for different ''from ID'' in that case it can be change..


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

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