Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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]
Posted 13-Jul-12 22:01pm
Edited 13-Jul-12 22:05pm
v2
Comments
OriginalGriff at 14-Jul-12 3:05am
   
Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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 here is the gmail password.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
 
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[^]
  Permalink  
Comments
Member 8561616 at 14-Jul-12 5:22am
   
Sir I have already written the Same Code but An Exception Comes "Failure Sending Mail"unable to connect to remote server.
Sandeep Mewara at 14-Jul-12 6:36am
   
Make sure that there is no firewall issue.
Sandeep Mewara at 14-Jul-12 6:38am
   
Also add this and see: SmtpServer.EnableSsl = True
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 305
2 Richard MacCutchan 270
3 Mathew Soji 220
4 BillWoodruff 210
0 OriginalGriff 8,834
1 Sergey Alexandrovich Kryukov 7,477
2 DamithSL 5,689
3 Maciej Los 5,329
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 14 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100