ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sending e-mail - Ron deBruin (https://www.excelbanter.com/excel-programming/310643-sending-e-mail-ron-debruin.html)

Steph[_3_]

Sending e-mail - Ron deBruin
 
Hello everyone. I stole the following piece of code from Ron deBruin's web
site. I am trying to automatically send an e-mail without all the new
Outlook security prompts. The code I grabbed is below. But when I run, I
get a "The SendUsing Configuration value is invalid". Any idea how to fix?

Sub Message()
' This example use late binding, you don't have to set a reference
' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim cell As Range
' Dim Flds As Variant

Application.ScreenUpdating = False

' Set iConf = CreateObject("CDO.Configuration")
' iConf.Load -1 ' CDO Source Defaults
' Set Flds = iConf.Fields
' With Flds
'
..Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill
in your SMTP server here"
'
..Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
' .Update
' End With

For Each cell In
Sheets("Sheet1").Columns("B").Cells.SpecialCells(x lCellTypeConstants)
If cell.Offset(0, 1).Value < "" Then
If cell.Value Like "*@*" And cell.Offset(0, 1).Value = "yes"
Then
Set iMsg = CreateObject("CDO.Message")
With iMsg
Set .Configuration = iConf
.To = cell.Value
.From = """Ron"" "
.Subject = "Reminder"
.TextBody = "Dear " & cell.Offset(0, -1).Value &
vbNewLine & vbNewLine & _
"Please contact us to discuss bringing your
account up to date"
.Send
End With
Set iMsg = Nothing
End If
End If
Next cell
Set iConf = Nothing
Application.ScreenUpdating = True
End Sub




All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com