LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Private Sub SendMessage ...


Can you make the following code work?
I have tried it in a regular Module and in ThisWorkbook without eve
being able to 'single-step' thru the code.

Code:

'Sending SMTP mail via port 25 using CDOSYS
'This VBA sample uses CDOSYS to send SMTP mail using th
cdoSendUsingPort option and specifying a SMTP host.

'Note: It is recommended that all input parameters be validated whe
they are
'first obtained from the user or user interface.
'
Private Sub SendMessage(strTo As String, strFrom As String)

'Send using the Port on a SMTP server
Dim iMsg As New CDO.Message
Dim iConf As New CDO.Configuration
Dim Flds As ADODB.Fields

Set Flds = iConf.Fields

strTo = "mail address 2"
strFrom = "mail address 1"

With Flds
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "your e-mail server name or IP address"
'
??????????????????????????????
'Use SSL to connect to the SMTP server:
'.Item(cdoSMTPUseSSL) = True
.Item(cdoSMTPUseSSL) = False
.Item(cdoSMTPConnectionTimeout) = 10
.Update
End With

With iMsg
Set .Configuration = iConf
.To = strTo
.From = strFrom
.Subject = "This is a test CDOSYS message (Sent by Port 25)"
.TextBody = "This is the text body of the message..."
.Send
End With

'cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

End Sub

I believe that I have selected all of the appropriate Projec
References.

TIA,
Chuckles12

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=39241

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Private Sub - Hot key? Arturo Excel Programming 1 June 23rd 05 07:17 PM
private sub JT Excel Programming 3 June 3rd 05 10:14 PM
Private sub Mark New Users to Excel 3 April 6th 05 03:36 PM
Private Sub Running Other Private Sub Inadvertently Ross Culver Excel Programming 2 February 10th 05 07:17 PM
Private Sub Ronbo Excel Programming 11 January 13th 05 08:25 PM


All times are GMT +1. The time now is 05:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"