Generate draft email in Outlook with shell script.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generate draft email in Outlook with shell script.
# 1  
Old 10-15-2014
Question Generate draft email in Outlook with shell script.

Hi All,

Is there any way to create a draft mail with HTML body in Outlook using Shell script.
# 2  
Old 10-15-2014
If by shell script you mean VBS script, then probably. Yes, you can install Cygwin, and that does allow you to do some shell scripting. But if you are running something on a Windows machine, then you should probably use a Windows tool like the Visual Basic Scripting (VBS) tool. You can probably also create and send HTML emails just using Perl and the MIME::Lite libraries. But if you do that you don't need Outlook and it doesn't matter what client or email system someone uses when they receive the email.
# 3  
Old 10-26-2014
This is quite easy to achieve using powershell:

Code:
$ol = New-Object -comObject Outlook.Application 
$ns = $ol.GetNameSpace("MAPI")

$Mail = $ol.CreateItem(0)
$Mail.Recipients.Add("to_person@domain.com")  
$Mail.Subject = "Testing email created from powershell"  
$Mail.HTMLBody = "<HTML><H2 style=""FONT-FAMILY: Tahoma, Geneva, Sans-serif;"">My HTML email.</H2><BODY>My body.</BODY></HTML>"
$Mail.save()

This User Gave Thanks to Chubler_XL For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script newbie- how to generate service log from shell script

Hi, I am totally a newbie to any programming languages and I just started an entry level job in an IT company. One of my recent tasks is to create a script that is able to show the log file of linux service (i.e. ntpd service) lets say, if I run my script ./test.sh, the output should be... (3 Replies)
Discussion started by: xiaogeji
3 Replies

2. Shell Programming and Scripting

UNIX script email to outlook report format

I have a ksh script that emails a report to outlook from a Unix Solaris. On server the report formatted perfectly. However, the email version the format is not. On the server report looks like this: TN Region Old SPiAD Server Order/Req Local Status NAAC Status Request Date New... (1 Reply)
Discussion started by: mrn6430
1 Replies

3. Shell Programming and Scripting

Generate documentation for a shell script

Hi, I've written a shell script with proper intentation and commenting structure. However, I would like to generate documentation for the shell which I have written. Is there any tool as such to generate it like we have javagen/docgen ? Please help. Thanks, Arjun (0 Replies)
Discussion started by: arjun_arippa
0 Replies

4. UNIX for Dummies Questions & Answers

Display Pie Chart/Bar Graph in microsoft outlook email using UNIX commands/Shell scripts

I have a shell script which executes to write html codes into a text file. My next step is to email the text file so that receiving person (people who i send email to) should be able to see pie/chart or bar graph (whatever i design in my code) in their email. Following is the example of a sample... (7 Replies)
Discussion started by: bikerboy
7 Replies

5. Shell Programming and Scripting

Outlook Email Body Format Issue

Hello All, I been trying to get a solution for a while not able to figure out. I am generating a file and sending that as an body of message to my outlook account. For some reason reason everything is showing up as one line in the email. for i in `cat "${GEN_PARAM_LIST3}"` do ... (0 Replies)
Discussion started by: Ariean
0 Replies

6. Shell Programming and Scripting

How to send a file in email from Solaris box to MS outlook 2010

Hi I have input file in solaris machine and my question is..,how to send email that input file to Microsoft outlook 2010 in excel /xls format. (5 Replies)
Discussion started by: buzzme
5 Replies

7. UNIX and Linux Applications

Send email from outlook to server

Hi, I am sending an email from Microsoft Outlook 2010 (microsoft exchange) to a unix server. I am not receiving the email in server but I am getting the following error in outlook. Your message: From: x@y.com Subject: Could not be delivered because the domain name was... (4 Replies)
Discussion started by: Neethu
4 Replies

8. Windows & DOS: Issues & Discussions

Help needed with backing up Outlook email folders and settings

I need to upgrade from Windows Me to Windows Xp, anyone can please tell me how can I backup everything in Outlook Express for an easy restore after reinstalling Windows? (3 Replies)
Discussion started by: Saanddra
3 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

10. UNIX for Dummies Questions & Answers

email file to Outlook using fixed font

I have a unix script that emails output from a sql script. Problem is that the email, once received in Outlook, is in a variable width font which misaligns the columns (I assume it picks up the users default font). Is there any way to send the desired fixed-width font to Outlook via mailx or elm?... (1 Reply)
Discussion started by: tonimac_az
1 Replies
Login or Register to Ask a Question