通过http代理发送邮件 [英] Sending mail through http proxy

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

问题描述

我正在尝试从通过 Internet 选项中设置的 http 代理连接到 Internet 的系统发送电子邮件.

I'm trying to send emails from a system that connects to internet through a http proxy which is set in Internet Options.

我正在使用 SmtpClient.

i'm using SmtpClient.

有没有办法通过这个代理设置用 SmtpClient 发送邮件.谢谢

Is there any way to send mails with SmtpClient through this proxy setting. Thanks

推荐答案

我知道您想使用浏览器的默认设置,我也想得到答案.

I understand that you want to use the browsers default settings, i would also like an answer for that.

同时,您可以手动完成.

Meanwhile, you could do it manually.

    MailAddress from = new MailAddress("from@mailserver.com");
    MailAddress to = new MailAddress("to@mailserver.com");

    MailMessage mm = new MailMessage(from, to);
    mm.Subject = "Subject"
    mm.Body = "Body";

    SmtpClient client = new SmtpClient("proxy.mailserver.com", 8080);
    client.Credentials = new System.Net.NetworkCredential("from@mailserver.com", "password");

    client.Send(mm);

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

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