Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call mail from vbs

Status
Not open for further replies.

elly00

Technical User
Jun 30, 2011
69
IT
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
 
If you are using CDO.Message, just change the .To, .Cc and .Bcc fields
 
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

 
hI

NO ONE HAVE ALREADY DONE SOMETHING LIKE THAT?

THANKSSSSSSSSSSSSSSSSSSSS
 
>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 ...
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top