Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6907967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:30:05+00:00 2026-05-27T08:30:05+00:00

I have the unfortunate task of sending e-mail through a client that needs to

  • 0

I have the unfortunate task of sending e-mail through a client that needs to connect to Outlook Anywhere through VBScript. I may not understand the correct terminology when dealing with Exchange Server, therefore the answer may be evading me simply because I don’t know what I’m searching for, and after hours on Google I still haven’t found the answer.

I cannot use SMTP, since the script will be connecting from many locations/networks and they may or may not block the traffic through the default port. I cannot change the default port because the network admin (who is the actual customer) will not change it.

Any pointers in the right direction will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:30:05+00:00Added an answer on May 27, 2026 at 8:30 am

    The answer to my question is partially on stackoverflow already at the following question Ways to send E-Mails over MS Exchange with VBScript.

    The code below (VBA, but close enough to VBScript) is simply sending a SOAP message to the Exchange Web Service. It was built from various bits and pieces found all over the web (including the links above).

    Option Explicit
    
    ' ---------------------------------------------------------
    ' CONFIGURATION - change as needed
    ' ---------------------------------------------------------
    Const TARGETURL = "https://mail.XXXXX.com/ews/exchange.asmx"
    Const USERNAME = "XXXXX\dnreply"
    Const PASSWORD = "X1X2X3X4X!x@x#x$x%"
    
    Sub SendMessageEWS()
        Dim SOAP
        SOAP = CreateMessageSOAP()
    
        ' Send the SOAP request, and return the response
        Dim oXMLHTTP, oXml
    
        Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP")
        Set oXml = CreateObject("MSXML2.DOMDocument")
    
        ' Send the request
        oXMLHTTP.Open "POST", TARGETURL, False, USERNAME, PASSWORD
        oXMLHTTP.setRequestHeader "Content-Type", "text/xml"
        oXMLHTTP.send SOAP
    
        If oXMLHTTP.Status = "200" Then
            ' Get response
            If oXml.LoadXML(oXMLHTTP.ResponseText) Then
                ' Success
                Debug.Print oXml.XML
            End If
        Else
            Debug.Print oXMLHTTP.ResponseText
            MsgBox "Response status: " & oXMLHTTP.Status
        End If
    
    End Sub
    
    Function CreateMessageSOAP()
        ' Normally this is done by using the DOM, but this is easier for a demo...
        Dim SOAPMsg
    
        SOAPMsg = SOAPMsg & "<?xml version='1.0' encoding='utf-8'?>"
        SOAPMsg = SOAPMsg & " <soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:t='http://schemas.microsoft.com/exchange/services/2006/types' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
        SOAPMsg = SOAPMsg & "   <soap:Body>"
        SOAPMsg = SOAPMsg & "     <CreateItem MessageDisposition='SendAndSaveCopy' xmlns='http://schemas.microsoft.com/exchange/services/2006/messages'>"
        SOAPMsg = SOAPMsg & "         <SavedItemFolderId>"
        SOAPMsg = SOAPMsg & "             <t:DistinguishedFolderId Id='sentitems' />"
        SOAPMsg = SOAPMsg & "         </SavedItemFolderId>"
        SOAPMsg = SOAPMsg & "         <Items>"
        SOAPMsg = SOAPMsg & "             <t:Message>"
        SOAPMsg = SOAPMsg & "                 <t:Subject>Exchange Web Service E-Mail Test</t:Subject>"
    ' For HTML message body
        SOAPMsg = SOAPMsg & "                 <t:Body BodyType='HTML'><![CDATA[<h1>Test html body</h1>]]></t:Body>"
    ' For text message body
    '    SOAPMsg = SOAPMsg & "                 <t:Body BodyType='Text'><![CDATA[Test text body]]></t:Body>"
        SOAPMsg = SOAPMsg & "                 <t:ToRecipients>"
        SOAPMsg = SOAPMsg & "                     <t:Mailbox>"
        SOAPMsg = SOAPMsg & "                         <t:EmailAddress>recipient@XXXXX.com</t:EmailAddress>"
        SOAPMsg = SOAPMsg & "                     </t:Mailbox>"
        SOAPMsg = SOAPMsg & "                 </t:ToRecipients>"
        SOAPMsg = SOAPMsg & "             </t:Message>"
        SOAPMsg = SOAPMsg & "         </Items>"
        SOAPMsg = SOAPMsg & "     </CreateItem>"
        SOAPMsg = SOAPMsg & "   </soap:Body>"
        SOAPMsg = SOAPMsg & " </soap:Envelope>"
    
        CreateMessageSOAP = SOAPMsg
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a time consuming task (iterating through files and sending it's content to
I know that XSLT does not work in procedural terms, but unfortunately I have
I have a template filter that performs a very simple task and works well,
I have the unfortunate task of cleaning up a bunch of old ColdFusion code.
I have the unfortunate task of having to import data from excel into a
I have the unfortunate task of doing (minimal) maintenance work on two legacy applications
Suppose I have a function that performs some task (this is in Python pseudocode):
I have a MSBuild task that modifies an assembly. At the moment I place
I have a task that takes quite a long time. So I would like
StackOverflow, you're my only hope! I am unfortunate enough to have inherited an ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.