Hi all,
I am a relative newbie to batch files. I'm more used to bash scripting. Just wondering if it is possible to create a batch file that will open outlook and edit an e-mail template or create a specifically formatted e-mail?
For example I have an e-mail that I send out regularly after creating a new Active Directory user that contains their username and phone number etc among other user specific info. At the moment I open outlook and manually edit the e-mail. I would rather that the batch file could grab the required details from Active directory and use this information to replace certain text in the email. Is this possible?
I know I can do something using the following format but then I loose all the formatting that outlook offers and there is a character limit AFAIK!
mailto:to?subject=subject&cc=cc_address&bcc=bcc_address&body=message_body
Any suggestions would be appreciated! Also I would rather not to use 3rd party tools/apps if possible
Thanks
Create Oulook E-mail from Batch File
Moderator: DosItHelp
Re: Create Oulook E-mail from Batch File
There is a method of automating an email using VB and Windows Scripting Host, wrapped in a batch file, but I don't know how to extract information from Active Directory.
Are there environment variables with AD info?
Could you call a batch file to pass the users name and details that you need to send?
Are there environment variables with AD info?
Could you call a batch file to pass the users name and details that you need to send?
-
- Posts: 21
- Joined: 23 Aug 2012 00:07
Re: Create Oulook E-mail from Batch File
Just on the mailto format - You might be able to use html as the formatting. Try this -
Code: Select all
start "" "mailto:?subject=Test Email&body=This is some <b>test text.</b>"
-
- Posts: 20
- Joined: 21 Dec 2012 13:36
- Location: United States
Re: Create Oulook E-mail from Batch File
Will the outlook.exe switches work for you?
http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx
Something like:
or using a template oft file:
or using an msg file.
http://office.microsoft.com/en-us/outlook-help/command-line-switches-HP001003110.aspx
Something like:
Code: Select all
"C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE" /c ipm.note /m "email@server.com"
or using a template oft file:
Code: Select all
"C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE" /t "C:\Users\<User>\AppData\Roaming\Microsoft\Templates\Untitled.oft"
or using an msg file.
Code: Select all
"C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE" /f "C:\Users\<User>\AppData\Roaming\Microsoft\Templates\Untitled.msg"