This code used to work fine; I suspect something's changed with my mailserver (which I don't have administrative access to):
It doesn't work anymore. I checked the address of my mailserver and it's correct.
I've tried playing around with the fields so I can directly authenticate using the username and password I have setup in my desktop mail client (Thunderbird), but it isn't working. I'm hoping I'm just leaving off a field or something?
Thanks for any assistance.
Code:
Public Sub SendMail()
Dim oMessage 'as System.Web.Mail.SmtpMail
Set oMessage = CreateObject("CDO.Message")
With oMessage
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = MailServer
.Configuration.Fields.Update
.From = "me@mydomain.com"
.To = Recipient
.Subject = Subject
.HTMLBody = Body
If Attachment <> "" Then .AddAttachment Attachment
.Send
End With
Set oMessage = Nothing
End Sub
It doesn't work anymore. I checked the address of my mailserver and it's correct.
I've tried playing around with the fields so I can directly authenticate using the username and password I have setup in my desktop mail client (Thunderbird), but it isn't working. I'm hoping I'm just leaving off a field or something?
Code:
Public Sub SendMail()
Dim oMessage 'as System.Web.Mail.SmtpMail
Set oMessage = CreateObject("CDO.Message")
With oMessage
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")[/URL] = 1
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/senduserName")[/URL] = "myusername"
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendpassword")[/URL] = "xxxxxxxx"
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusingport")[/URL] = 2
.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/urlproxyserver")[/URL] = "server:80"
.Configuration.Fields.Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = MailServer
.Configuration.Fields.Update
.From = "me@mydomain.com"
.To = Recipient
.Subject = Subject
.HTMLBody = Body
If Attachment <> "" Then .AddAttachment Attachment
.Send
End With
If err.Number <> 0 Then MsgBox err.Description
Set oMessage = Nothing
End Sub
Thanks for any assistance.