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 9039823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:49:32+00:00 2026-06-16T09:49:32+00:00

I am currently using the following VBS script to send an email and it

  • 0

I am currently using the following VBS script to send an email and it works fine, however the image is sent as an attachment. I would instead like to embed the image into the email. I understand that I must reference the attachment in the HTML body of the email but I am struggling to do this.

Any suggestions?

Dim ToAddress
Dim FromAddress
Dim MessageSubject
Dim MyTime
Dim MessageBody
Dim MessageAttachment
Dim ol, ns, newMail
MyTime = Now

ToAddress = "email@address.com"
MessageSubject = "Auto Stats " & MyTime
MessageBody = "Stats Attached" & vbCrLf & "Produced at " & MyTime
MessageAttachment = "P:\stats.png"
Set ol = WScript.CreateObject("Outlook.Application")
Set ns = ol.getNamespace("MAPI")
Set newMail = ol.CreateItem(olMailItem)
newMail.Subject = MessageSubject
newMail.Body = MessageBody
newMail.RecipIents.Add(ToAddress)
newMail.Attachments.Add(MessageAttachment)
newMail.Send
  • 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-06-16T09:49:34+00:00Added an answer on June 16, 2026 at 9:49 am

    use the code below

    Const PR_ATTACH_MIME_TAG = "http://schemas.microsoft.com/mapi/proptag/0x370E001E"
    Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
    Const PR_ATTACHMENT_HIDDEN = "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"
    
    
    Sub testing2()
    Dim ToAddress
    Dim FromAddress
    Dim MessageSubject
    Dim MyTime
    Dim MessageBody
    Dim MessageAttachment
    Dim ol, ns, newMail
    Dim realAttachment
    MyTime = Now
    
    ToAddress = "testing@address.com"
    MessageSubject = "Auto Stats " & MyTime
    MessageBody = "Stats Attached" & vbCrLf & "Produced at " & MyTime
    MessageAttachment = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
    Set ns = Outlook.GetNamespace("MAPI")
    Set newMail = Outlook.CreateItem(olMailItem)
    newMail.Subject = MessageSubject
    newMail.Body = MessageBody
    newMail.Recipients.Add (ToAddress)
    Set realAttachment = newMail.Attachments.Add(MessageAttachment)
    Set oPA = realAttachment.PropertyAccessor
    oPA.SetProperty PR_ATTACH_MIME_TAG, "image/jpeg"
    oPA.SetProperty PR_ATTACH_CONTENT_ID, "myident" 'change myident for another other image
    newMail.HTMLBody = newMail.HTMLBody & "<IMG align=baseline border=0 hspace=0 src=cid:myident>" 'need to match the "myident" above
    newMail.Send
    End Sub
    

    Hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently using the following script-- <?php // Set the content-type header('Content-type: image/png'); //
I'm currently using the following jQuery plugin: jQuery OEmbed. This plugin works great in
I am currently using the following script to set this value as a String:
I am currently using following script in a hover-functionality: function UrlExists(url) { var http
I am currently using the following formula =SUM(INDIRECT('Net &($A$2)& &RIGHT($A48,2)&'!C4:C21)) That works out perfectly,
We're currently using the following for creating US dollar values in our web application:
I am currently using the following code to update form data before submission. $('.countyx').change(function(){
I'm currently using the following code to append a X link to each element
I am currently using the following algorithm to search on my iPhone app: NSRange
I'm currently using the following code (C#): private static void PlayLoop(string filename) { Audio

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.