how to use gmail to send messages from command prompt?

HOW TO USE GMAIL TO SEND MESSAGES FROM COMMAND PROMPT?

HAY PEOPLE,

I HAVE A QUESTION.
I DISCOVERED WERY USEFULL COMMAND IN COMMAND.COM
IT IS
POWERSHELL -COMMAND -SEND-MAILMESSAGE
I WANT TO WRITE A BATCH PROGRAM (WHICH CONTAINS MIXED CMD AND POWERSHELL CODE) WHICH WILL SEND ME AN E-MAIL MESSAGE WHENEVER SOMEONE STARTS WINDOWS ON MY COMPUTER.
BUT, I USE GMAIL ACCOUNT, AND IT LOOKS LIKE IT DOES NOT WORK WITH IT.
I TRIED THIS SCRIPT TO SEND A TEST MESSAGE AND IT DID NOT WORK:
INSIDE TEST.BAT:
@ECHO OFF
ECHO:SENDING TEST MAIL...
POWERSHELL -COMMAND SEND-MAILMESSAGE -TO "SYOBSYOT@GMAIL.COM" -FROM "SYOBSYOT@GMAIL.COM" -SUBJECT "TEST" -BODY "TESTING E-MAIL AUTOMATED SCRIPT" -SMTPSERVER "MAIL.GOOGLE.COM"
ECHO:FINISHED ATEMPTING TO SEND.
EXIT
BUT, THIS SCRIPT FAILS WITH THE FOLLOWING OUTPUT:
SENDING TEST MAIL...
Send-MailMessage : Unable to connect to the remote server
At line:1 char:17
+ SEND-MAILMESSAGE <<<< -TO "SYOBSYOT@GMAIL.COM" -from "SYOBSYOT@GMAIL.COM" -subject "TEST" -BODY "TESTING E-MAIL AUTOMATED SCRIPT" -SMTPSERVER "MAIL.GOOGLE.COM"
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
FINISHED ATEMPTING TO SEND.
I THINK THAT IT MIGHT BE BECAUSE GMAL REQUIRES USERNAME AND PASSWORD.
BUT, HOW TO SPECIFY IT IN THIS COMMAND?
AND, I THINK THAT IF THERE IS SOME ANONYMOUS SMTP SERVER THAT IT WOULD WORK WITHOUT USERNAME AND PASSWORD.

SO, DO YOU KNOW HOW TO FIX THIS, SO MY SCRIPTS CAN SEND E-MAILS FROM GMAIL FOR ME?
OR, IF IT CAN NOT BE DONE, WILL IT WORK WITH ANONYMOUS SMTP SERVER, AND IF IT WILL, HOW TO MODIFY THIS CODE TO USE IT WITH THAT SERVER?

ANY CODE MODIFICATIONS ARE WELCOME WITH THE ANSWER.

THANK YOU,
SYOB SYOT ♥
(BTW, I AM USING WINDOWS SERVER 2008 (BUT THERE WAS NO WINDOWS SERVER 2008 CATEGORY SO I POSTED IN WINDOWS VISTA, SINCE WINDOWS SERVER 2008 IS WERY SIMILAR WITH WINDOWS VISTA) WITH POWERSHELL 2.0 AND CMD)
1 answer Last reply
More about gmail send messages command prompt
Ask a new question

Read More

Windows Vista Command Prompt Gmail PowerShell Email