Saturday, December 3, 2011

Gmail CommandLline

Syntax for emailing from gmail using command line tool (attached below):

mail -f my@gmail.com -d gmail.com -smtp smtp.gmail.com -port 587 -t my@gmail.com -sub "This is the email subject" -from my@gmail.com -cc techsupport@gmail.com +bcc -v -starttls -auth -user USERNAME -pass PASSWORD -M "My email message"

To put into windows script for easy management:

email.bat
---------------------------------------------------
@echo off

if NOT DEFINED m set m="Email test"
if NOT DEFINED sub set sub="Email test subject"

REM --------From, To and CC-----------
SET f=<FROM EMAIL ADDRESSS>
SET cc=<CC EMAIL ADDRESS>

REM ------username/pass-------
SET usr=<GMAIL USERNAME>
SET pass=<GMAIL PASSWORD

REM ------other values----------
SET p=587
SET sm=smtp.gmail.com
SET d=gmail.com
SET v=+bcc-starttls -auth 

echo Emailing To/From:%f% 
echo Subject: %sub%
echo Message: %m%
echo.
mail -f %f% -d %d% -smtp %sm% -port %p% -t %f% -sub %sub% -from %f% -cc %cc% %v% -user %usr% -pass %pass% -M %m%
pause

---------------------------------------------------

Download 231k

No comments: