在代理服务器上发送邮件 [英] Send Mail on Proxy Server

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

问题描述

我们可以使用gmail从代理服务器发送邮件吗?
如果是
那么它的设置和代码应该是什么.
请给我发送有关[DELETED] @ gmail.com的信息"

[edit]电子邮件地址已删除-OriginalGriff [/edit]

Can we Send mail from Proxy Server using gmail.
if yes
then what should be the setting and code for this.
Plz Send me Information on [DELETED]@gmail.com"

[edit]Email address deleted - OriginalGriff[/edit]

推荐答案

是的,如果未安装SMTP服务器,则可以通过gmail向客户端发送邮件.

Yes you can send mail through gmail to the client if the SMTP server is not installed.

string emailid=emailtxt.Text;

 MailMessage mail = new MailMessage();
            mail.To.Add(emailid);
            
            mail.From = new MailAddress("xyz@gmail.com");
            mail.Subject = "Email using Gmail";

            string Body = "Hi all" ;
                       
            mail.Body = Body;
 
            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com"; 
            smtp.Credentials = new System.Net.NetworkCredential
                 ("xyz@gmail.com", "yourpassword");
            
            smtp.EnableSsl = true;
            smtp.Send(mail);


yourpassword是gmail密码.


yourpassword here is the gmail password.


使用gmail
从代理服务器发送邮件 是的,您可以发送. GMail已公开了它的SMTP服务器名称(smtp.gmail.com)和端口(587).
试试:
Send mail from Proxy Server using gmail
Yes, you can send. GMail has exposed it''s SMTP server name(smtp.gmail.com) and PORT(587) for it.
Try:
Imports System.Net.Mail
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim SmtpServer As New SmtpClient()
            Dim mail As New MailMessage()
            SmtpServer.Credentials = New Net.NetworkCredential("username@gmail.com", "password")
            SmtpServer.Port = 587
            SmtpServer.Host = "smtp.gmail.com"
            mail = New MailMessage()
            mail.From = New MailAddress("YOURusername@gmail.com")
            mail.To.Add("TOADDRESS")
            mail.Subject = "Test Mail"
            mail.Body = "This is for testing SMTP mail from GMAIL"
            SmtpServer.Send(mail)
            MsgBox("mail send")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class



不过,如果需要,请查看以下内容:
视频:VB.NET-使用Gmail发送电子邮件-YouTube [如何通过VB.NET从您的GMAIL帐户发送邮件或C#. Windows编程,具有一些自定义功能 [ ^ ]



Still, In case needed, have a look at these:
Video: VB.NET - Sending an E-mail using Gmail - YouTube[^]
How to Send Mails from your GMAIL Account through VB.NET or C#. Windows Programming, with a Bit of Customization[^]


否. SMTPClient类不支持代理.

据我所知,实际上甚至没有关于SMTP代理支持的规范.有解决方法,但是公司很少让您放弃使用它们.

通常,您的代理服务器内部将具有SMTP服务器,该服务器可以将邮件转发到外部邮件服务器.
No. The SMTPClient class doesn''t support proxies.

There''s really not even a specification for SMTP proxy support as far as I know. There are work arounds, but companies rarely ever let you get away with using them.

You would normally have a SMTP server INSIDE your proxy that can forward mail to outside mail servers.


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

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