Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Private Sub - Hot key? | Excel Programming | |||
private sub | Excel Programming | |||
Private sub | New Users to Excel | |||
Private Sub Running Other Private Sub Inadvertently | Excel Programming | |||
Private Sub | Excel Programming |