Sending an email via SMTP with VBScript: Difference between revisions
Jump to navigation
Jump to search
Jkuehlthau (talk | contribs) No edit summary Tag: Reverted |
Jkuehlthau (talk | contribs) No edit summary Tag: Manual revert |
||
Line 1: | Line 1: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="vb"> | ||
Sub VBScriptProcedure | Sub VBScriptProcedure | ||
Set objMessage = CreateObject("CDO.Message") | Set objMessage = CreateObject("CDO.Message") |
Revision as of 20:21, 11 July 2024
Sub VBScriptProcedure Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "TEST SUBJECT!" objMessage.From = "trevor.walker@techadv.com" objMessage.To = "justin.kuehlthau@techadv.com" objMessage.TextBody = "Test Body" Set objConfig = objMessage.Configuration objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "sandbox.smtp.mailtrap.io" objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "8bff8a885fa97c" objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "630b8fef12e981" 'Server port (typically 25) objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true objConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60 objConfig.Fields.Update objMessage.Send End Sub