Подскажите пожалуйста как отправить e-mail через прокси
Я делал вот так:
- Код: Выделить всё
Option Explicit
Sub Send_Mail()
Const CDO_Cnf = "http://schemas.microsoft.com/cdo/configuration/"
Dim oCDOCnf As Object, oCDOMsg As Object
Dim SMTPserver As String, sUsername As String, sPass As String, sMsg As String, proxy As String
Dim sTo As String, sFrom As String, sSubject As String, sBody As String, sAttachment As String
On Error Resume Next
SMTPserver = "smtp.bk.ru"
sUsername = "user@bk.ru"
sPass = "password"
proxy = "107.7.144.62:80"
If Len(SMTPserver) = 0 Then MsgBox "Не указан SMTP сервер", vbInformation, "email vba": Exit Sub
If Len(sUsername) = 0 Then MsgBox "Не указана учетная запись", vbInformation, "email vba": Exit Sub
If Len(sPass) = 0 Then MsgBox "Не указан пароль", vbInformation, "email vba": Exit Sub
sTo = "tosend@yandex.ru"
sFrom = "user@bk.ru"
sSubject = "TEST"
sBody = "Привет от TEST"
Set oCDOCnf = CreateObject("CDO.Configuration")
With oCDOCnf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/urlproxyserver").Value = proxy
.Item(CDO_Cnf & "sendusing") = 2
.Item(CDO_Cnf & "smtpauthenticate") = 1
.Item(CDO_Cnf & "smtpserver") = SMTPserver
.Item(CDO_Cnf & "sendusername") = sUsername
.Item(CDO_Cnf & "sendpassword") = sPass
.Update
End With
Set oCDOMsg = CreateObject("CDO.Message")
With oCDOMsg
Set .Configuration = oCDOCnf
.BodyPart.Charset = "koi8-r"
.From = sFrom
.To = sTo
.Subject = sSubject
.TextBody = sBody
If Len(sAttachment) > 0 Then .AddAttachment sAttachment
.Send
End With
Сообщение отправляется, но почему то не через прокси, в теле письма все равно вижу ip и имя пользователя моего компьютера. Подскажите пожалуйста как быть?