topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 5:35 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Send email from cmdline !  (Read 26897 times)

hulkbuster

  • Participant
  • Joined in 2009
  • *
  • Posts: 259
    • View Profile
    • Donate to Member
Send email from cmdline !
« on: May 10, 2014, 12:21 AM »
Hello,
    i just wanted to know is it possible to really send an email from cmdline ! I checked many youtube videos , but i was not clear enough.
Also i googled and found some tools that could do so.

But it just goes over my head. Can someone tell me the method to do so. cmdline tool and another
For reasons , like time taken when composing an email from yahoo or gmail is what i don't like.

Thank you.
ClipDiary 5.3/ Smadav 2018/ Some Sense

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Send email from cmdline !
« Reply #1 on: May 10, 2014, 07:31 AM »
Blat is a well regarded command line emailer. I have this on all my servers for sending notifications, job results, etc. Simple syntax, good debugging options, and options for almost everything. (Of course the license prohibits sending spam.)

Blat is for sending emails - it is not written for composing emails. It presumes you have some content that you want to send. If you need to run a program to compose your message, then you might as well use a normal email client.
vi vi vi - editor of the beast

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #2 on: May 10, 2014, 10:35 AM »
This might be more interesting: http://caspian.dotco.../Software/SendEmail/

Basic use would be:
sendEmail -f <your email address> -t <receiver mail adress(es)> -u <preferred subject> -m <message you want to send> -s <name or IP from your mail server(: optional port)>

or if this is more clear:
sendEmail -f [email protected] -t [email protected] -u "My first message" -m "Hello world" -s internal.mail.server


There are lots more options, the included help is quite clear.
« Last Edit: May 10, 2014, 10:49 AM by Shades »

hulkbuster

  • Participant
  • Joined in 2009
  • *
  • Posts: 259
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #3 on: May 10, 2014, 12:56 PM »
This might be more interesting: http://caspian.dotco.../Software/SendEmail/

Basic use would be:
sendEmail -f <your email address> -t <receiver mail adress(es)> -u <preferred subject> -m <message you want to send> -s <name or IP from your mail server(: optional port)>

or if this is more clear:
sendEmail -f [email protected] -t [email protected] -u "My first message" -m "Hello world" -s internal.mail.server


There are lots more options, the included help is quite clear.

No mate , its not working. I follow ur cmdline. I want to mail using my gmail account to a yahoo account.
The homepage doesn't provide enough material to comprehend.
ClipDiary 5.3/ Smadav 2018/ Some Sense

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #4 on: May 10, 2014, 01:07 PM »
It's not command line but Thunderbird can be configured to access many web mail accounts as pop3.  One example is hotmail.  It can probably do gmail too but I'm not certain.

http://kb.mozillazin...th_your_email_client

Edit:  also there may be an AddOn for Thunderbird that does the gmail setup for you.
« Last Edit: May 10, 2014, 01:30 PM by MilesAhead »

hulkbuster

  • Participant
  • Joined in 2009
  • *
  • Posts: 259
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #5 on: May 10, 2014, 03:59 PM »
For the first link: An Email Program for Sending SMTP Mail from a Command Line An Email Program for Sending SMTP Mail from a Command Line
The commands were:

SendEmail -f [email protected] -t [email protected] -s "SERVER[:PORT] (If using gmail, -s smtp.gmail.com:587)" -xu "[email protected]" -xp "password" -u "Hello their" -m "How are you."

This is how it would look:
SendEmail -f [email protected] -t [email protected] -s smtp.gmail.com:587 -xu [email protected] -xp xxxxx -u "Hello their" -m "How are you."

But i am getting an error
Authentication not supported by the remote SMTP server!

Must issue a STARTTLS command first. o7sm20727708eew.25 - gsmtp
Checking more on Blat.
ClipDiary 5.3/ Smadav 2018/ Some Sense

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #6 on: May 10, 2014, 04:52 PM »
There are 2 different versions for Windows. One that supports TLS and one that doesn't. It is important you use the correct one and perhaps add: -o tls=auto at the end of the line you created.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #7 on: May 10, 2014, 04:58 PM »

hulkbuster

  • Participant
  • Joined in 2009
  • *
  • Posts: 259
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #8 on: May 14, 2014, 12:02 PM »
Hello so their were two versions of this program i.e.,
1:SendEmail TLS supported
2:SendEmail No TLS support

For TLS support the command i gave was:
SendEmail -f [email protected] -t [email protected] -s smtp.gmail.com:587 -xu [email protected] -xp xxxxx -u "Hello their" -m "How are you." -o tls=yes
The error message i got was " SMTP-AUTH: Authentication to smtp.gmail.com:587 failed. "

For No TLS support :
SendEmail -f [email protected] -t [email protected] -s smtp.gmail.com:587 -xu [email protected] -xp xxxxx -u "Hello their" -m "Hello there." -o tls=no
The error message i got was" Authentication not supported by the remote SMTP server!
                              Must issue a STARTTLS command first. gn3sm4344660pbc.32 - gsmtp"

I don't understand what i am doing wrong.
Has anyone tried it, it would prove really useful to have a command based email support.
         
Another cli client
http://www.codeproje...-using-GMail-Account
This was really confusing , there is no sendmail.exe file that could relay the commands:
mailsend.exe -to %1 -from %2 -sub "test from windows" -starttls -port 587 -auth -smtp smtp.gmail.com -user "%2" -pass %SMTP_USER_PASS% -M "hello one liner" -log "c:\Users\mqt\Downloads\m.log"
Sorry i had downloaded the unix version, but after using the windows version as well, it doens't work.

Blat really was tricky, having one to install all the profile and still not able to work with the commands.
Any suggestion would be great.

Thank you.
ClipDiary 5.3/ Smadav 2018/ Some Sense
« Last Edit: May 14, 2014, 12:10 PM by hulkbuster »

Shades

  • Member
  • Joined in 2006
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #9 on: May 14, 2014, 05:04 PM »
Some 3rd party mail servers require you to login using POP3/IMAP before you are allowed to send mail through their SMTP server (spam prevention method). And given the amount of users the Google mail servers have to use that method. Their traffic is already impressive enough with this method.

You don't have access to another mail server?

x16wda

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 888
  • what am I doing in this handbasket?
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Send email from cmdline !
« Reply #10 on: May 14, 2014, 08:14 PM »
Blat really was tricky, having one to install all the profile and still not able to work with the commands.
Any suggestion would be great.

Actually you should be able to put all the required information on one command line, although installing the server and from info in the profile makes it easier for subsequent use. But the info you would need to use Blat would be exactly the same info you would need to set up an email client like Outlook or Thunderbird or whatever - account name, ISP servers, password, etc - plus what you would need for your email - subject, recipient, body.

One of the things you need to know is the name of either your email smtp server or your recipient's email server. Yours is preferable, the recipient's server might block your email because it would (probably) be coming from a residential or dynamic address. Your own ISP would be more likely to allow an email from one of its own addresses to run through its servers.

To send a text file named "mymessage.txt" as the body of the message to [email protected], you'd do something like this:

blat.exe mymessage.txt -to [email protected] -from [email protected] -subject "This is an email" -server smtp-server.location.rr.com -u [email protected] -pw hulkbusterpassword -debug

The -u and -pw options might be needed for authentication; your ISP would want to make sure you have an account. The -debug option should show you the conversation between Blat and your ISP, which can be extremely useful for troubleshooting. I just used the Roadrunner server name pattern for this example.
vi vi vi - editor of the beast

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,612
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #11 on: May 15, 2014, 01:32 AM »
For TLS support the command i gave was:
SendEmail -f [email protected] -t [email protected] -s smtp.gmail.com:587 -xu [email protected] -xp xxxxx -u "Hello their" -m "How are you." -o tls=yes
The error message i got was " SMTP-AUTH: Authentication to smtp.gmail.com:587 failed. "
Are you sure you want to use this: -xu urname@gmail.com.com ? Shouldn't that be like: -xu [email protected]

jpfx

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 155
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #12 on: May 15, 2014, 10:12 AM »
meh, just sayin explaining how to use command line e-mail tools for yahoo or gmail is too close to explaining how to send spam for me to be comfortable.
       |\      _,,,---,,_         
ZZZzzz /,`.-'`'    -.  ;-;;, 
      |,4-  ) )-,_. ,\ (  `'-'    
     '---''(_/--'  `-'\_)

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #13 on: May 15, 2014, 04:05 PM »
the info you would need to use Blat would be exactly the same info you would need to set up an email client like Outlook or Thunderbird or whatever
Agreed, though as I don't know much about it, I've found subtle differences between clients, anti-spam programs etc. hair-tearing, especially in their terminology regarding connection type and authentication.

hulkbuster

  • Participant
  • Joined in 2009
  • *
  • Posts: 259
    • View Profile
    • Donate to Member
Re: Send email from cmdline !
« Reply #14 on: May 16, 2014, 01:29 AM »
To send a text file named "mymessage.txt" as the body of the message to [email protected], you'd do something like this:
blat.exe mymessage.txt -to [email protected] -from [email protected] -subject "This is an email" -server smtp-server.location.rr.com -u [email protected] -pw hulkbusterpassword -debug
The -u and -pw options might be needed for authentication; your ISP would want to make sure you have an account. The -debug option should show you the conversation between Blat and your ISP, which can be extremely useful for troubleshooting. I just used the Roadrunner server name pattern for this example.

Is this process of correct first to install:
Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]]
Blat -install smtp.gmail.com [email protected] 2 587 hulk

Sending an email:
 
Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]]
blat.exe mymessage.txt -to [email protected] -from [email protected] -subject "This is an email" -server smtp-server.location.rr.com -u [email protected] -pw hulkbusterpassword -debug
or
  blat.exe c:\a.txt -to [email protected] -from [email protected] -subject "This is an email" -server smtp-server.location.rr.com -u [email protected] -pw hulkbusterpassword -debug
ClipDiary 5.3/ Smadav 2018/ Some Sense