2012-01-16 63 views
1
Private Function SendEMail(ByVal sendTo As String, ByVal subject As String) As Boolean 
     Try 
      ''# Dim cr As New System.Net.NetworkCredential("me073055", "me271288") 
      ''# Dim pr As New System.Net.WebProxy("172.31.100.25", 3128) 
      ''# pr.Credentials = cr 


      Dim mail As New MailMessage() 
      mail.[To].Add(sendTo) 

      ''# MsgBox(mail.[To].ToString) 

      mail.From = New MailAddress(TextBoxFromAddress.Text, "NyxSolutions") 
      mail.Subject = subject & " Automation System" 
      ''# MsgBox(mail.Subject) 
      Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString("", Nothing, "text/plain") 
      Dim htmlView As AlternateView = AlternateView.CreateAlternateViewFromString("<img src=cid:companylogo><br/><a href='http://www.nyxsolutions.in'>Click Here to visit our website</a><br/><a href='mailto:[email protected]'> Click Here to send us an email</a>", Nothing, "text/html") 

      Dim logo As New LinkedResource(TextBoxSelectPicture.Text) 
      logo.ContentId = "companylogo" 
      htmlView.LinkedResources.Add(logo) 

      mail.AlternateViews.Add(plainView) 
      mail.AlternateViews.Add(htmlView) 
      Dim Body As String = "" 
      mail.Body = Body 
      mail.Attachments.Add(New Attachment(TextBoxAttachment1.Text)) 
      ''# mail.Attachments.Add(New Attachment(TextBoxAttachment2.Text)) 
      ''# mail.Attachments.Add(New Attachment(TextBoxAttachment3.Text)) 

      mail.IsBodyHtml = True 
      Dim smtp As New SmtpClient() 
      smtp.Host = "smtp.gmail.com" 
      smtp.Port = 25 
      smtp.UseDefaultCredentials = True 
      smtp.Credentials = New System.Net.NetworkCredential(TextBoxFromAddress.Text, "vinson24") 
      smtp.EnableSsl = True 
      smtp.Send(mail) 
      ''# MsgBox("Sent") 
     Catch ex As SmtpException 
      MsgBox(ex.Message) 
     End Try 
    End Function 

我使用給定的代碼來發送電子郵件...我在代理服務器後..有什麼辦法給代理設置的SMTP客戶端??如果不是那麼我該如何從代理服務器後面發送電子郵件.. ??代理與smtp

這些是我需要用來連接到互聯網的設置...我需要在我的電子郵件客戶端中設置此設置。

enter image description here

+0

SMTP代理?簡單:將郵件發送到代理。 – 2012-01-16 18:08:07

+0

你是什麼意思? – user1150440 2012-01-16 18:10:33

+0

是他們的代理背後的客戶端機器? IE:使用Outlook的辦公室?如果是這樣,請問他們如何從代理後面進行身份驗證...在您的應用中使用相同的設置。 – 2012-01-16 18:12:50

回答