Page 1 of 1

send email via batch

Posted: 21 Jun 2019 08:02
by sal21
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" 

Re: send email via batch

Posted: 21 Jun 2019 14:30
by aGerman
https://social.technet.microsoft.com/wi ... tches.aspx
I don't see any command line option to send an email, sorry.

Steffen

Re: send email via batch

Posted: 21 Jun 2019 19:08
by penpen
The following might help you (although there is no MS Outlook involved):
viewtopic.php?f=3&t=3566

penpen

Re: send email via batch

Posted: 22 Jun 2019 15:02
by misol101
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