send email via batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sal21
Posts: 22
Joined: 12 Jul 2016 12:58
Location: Italy

send email via batch

#1 Post by sal21 » 21 Jun 2019 08:02

this lines open the email .oft, but not send directlly the email...
how to send email directlly via cmd?
tks.

Code: Select all

@echo off 
cd C:\SERVIZIO\
start "C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE" "Monitoraggio.oft" 

aGerman
Expert
Posts: 3706
Joined: 22 Jan 2010 18:01
Location: Germany

Re: send email via batch

#2 Post by aGerman » 21 Jun 2019 14:30

https://social.technet.microsoft.com/wi ... tches.aspx
I don't see any command line option to send an email, sorry.

Steffen

penpen
Expert
Posts: 1723
Joined: 23 Jun 2013 06:15
Location: Germany

Re: send email via batch

#3 Post by penpen » 21 Jun 2019 19:08

The following might help you (although there is no MS Outlook involved):
viewtopic.php?f=3&t=3566

penpen

misol101
Posts: 381
Joined: 02 May 2016 18:20

Re: send email via batch

#4 Post by misol101 » 22 Jun 2019 15:02

If you are ok with using an external tool, "mailsend" could help:

https://github.com/muquit/mailsend . There is a link from that page with Windows binaries.

Example usage with Gmail as SMTP server:

mailsend -smtp smtp.gmail.com -to somebody@yahoo.com -from someone@gmail.com -sub "Hello my friend" -ssl -auth -port 465 -M "Hello again..." -user someone@gmail.com -pass mypassword

(although in order for this to work for Gmail specifically one must go to https://myaccount.google.com/security?p ... nectedapps and enable "Allow less secure app". But depends which SMTP server you would like to use)

mailsend -h for help


EDIT: I see now you want to use Outlook. If it is a must, then I would use something like AutoHotkey (or even cmdwiz) to wait for the window to show and then send a key-combo or mouse-press to send

Post Reply