×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

call mail from vbs

call mail from vbs

call mail from vbs

(OP)
Hi
I have a little program in vbscript that open a ms outlook mail writing to addess, mail text and attach
mail.Display 'visualizzo la mail
'mail.send

Now I would like to block the user to modify the address mail (so the TO and CC field)
Is that possible?

thanks

RE: call mail from vbs

If you are using CDO.Message, just change the .To, .Cc and .Bcc fields

RE: call mail from vbs

(OP)
hi
thank..

My code is like this (see below)
but I don't understanf how can I block user changes in A filed

THANKS


CODE

set out=createobject("outlook.application")
  set namespace=out.getnamespace("mapi")
  
  set mail=out.createitem(0)


  mail.to=xmail
  mail.HTMLBody=MyHTML 
  mail.subject=mailobject

  set attached = mail.attachments
  s = Split(ls, "{") 	'---splitto la lista di allegati CERCANDO IL SIMBOLO {


'-----------------------merge dei pdf indicati nei path righe del documento -------------------------------
Set fso = CreateObject("Scripting.FileSystemObject")
sFolder = pathdoc                     
    bFirstDoc = True

' For Each strAttach In s
        If LCase(Right(strAttach, 4)) = ".pdf" Then
        
            If bFirstDoc Then
                bFirstDoc = False
                Set oMainDoc = CreateObject("AcroExch.PDDoc")
                oMainDoc.Open strAttach
            Else
                Set oTempDoc = CreateObject("AcroExch.PDDoc")
                oTempDoc.Open  strAttach
                oMainDoc.InsertPages oMainDoc.GetNumPages - 1, oTempDoc, 0, oTempDoc.GetNumPages, False
                oTempDoc.Close
                End If
         End If
    Next
    
    set filesys=CreateObject("Scripting.FileSystemObject") 
    If Not filesys.FolderExists(sFolder) Then 
     Set folder = filesys.CreateFolder(sFolder) 
    End If

    oMainDoc.Save 1, sFolder & "\"&attachname&".pdf"
    oMainDoc.Close
    'MsgBox "Creazione PDF Terminata"

'-----------------------merge dei pdf indicati nei path righe del documento -------------------------------

 attached.Add sFolder & "\"&attachname&".pdf"  

  mail.Display       
 

  ls=""
 
  'mail.send
   Set mail = Nothing 
   Set out = Nothing 
   set ls = Nothing 

RE: call mail from vbs

(OP)
hI

NO ONE HAVE ALREADY DONE SOMETHING LIKE THAT?

THANKSSSSSSSSSSSSSSSSSSSS

RE: call mail from vbs

>mail.Display

This brings up Outlook's associated inspector for a mail item, which will be the send form. You can't lock fields against editing in the default send form.

SO you might want to display the email in your own form, rather than the inspector's default one. Which basically means refactoring your code as an HTA, or doing a LOT of heavy lifting to create and leverage custom Outlook forms ...

RE: call mail from vbs

(OP)
Hi,

thanks for your big help..
Have you a simple code to send me in order to configure using HTA? And this code can be manage within a vbs file?
I have the big limitation that the code must be in a vbs file ;(

THANKS

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close