VBScript SMTP Server

后端 未结 1 1396
野趣味
野趣味 2020-12-06 23:51

I have set this up to auto email through the Outlook client, is it possible to change this code to work directly through an SMTP server? And could anyone possibly help me do

相关标签:
1条回答
  • 2020-12-07 00:23

    If you want to send mail directly to an SMTP server, there's no need to go through Outlook in the first place. Just use CDO. Something like this:

    schema = "http://schemas.microsoft.com/cdo/configuration/"
    
    Set msg = CreateObject("CDO.Message")
    msg.Subject  = "Test"
    msg.From     = "sender@example.com"
    msg.To       = "recipient@example.org"
    msg.TextBody = "This is some sample message text."
    
    With msg.Configuration.Fields
      .Item(schema & "sendusing")      = 2
      .Item(schema & "smtpserver")     = "smtp.intern.example.com"
      .Item(schema & "smtpserverport") = 25
      .Update
    End With
    
    msg.Send
    
    0 讨论(0)
提交回复
热议问题