Tuesday 15 February 2011

sendEmail

FUN WITH EMAIL


sendEmail in installed by default on the backtrack OS, and the options can simply be checked by typing ;

sendEmail




















Make sure your ISP does not have any problems with the use of sendEmail prior to sending loads of mails
to your roomate from MeganFox@movieworld.com ..

This is by no means an anonymous emailing method, there will always be IP address details mentioned in the email headers and you need to specify the smtp server to use.
You can specify to use the smtp server of the connection you have in place, or you can specify to use for instance the gmail smtp server.
When using the gmail smtp server however, the gmail address will be seen as the reply address.


Also, it is quite likely that some of the messages made such as the below examples will be picked up as spam..
YMMV depending on how often you test on certain addresses.


In any case, for an unsuspecting, not too savvy recipient.. it can lure the recipient to malafoid webpages or entice to open attachments etc.

SENDING BASIC EMAIL

So lets start off by creating a simple message, sending it to my gmail account using my ISP's smtp server;
(do a google on smtp servers to find the one your ISP is using)

-f   From (sender) email address
-t   To email address
-u   Subject (in quotes)
-m  Message body
-s   smtp server

I will seperate the commands partially using backslash \ as I get confused with long lines :)

It is important to note that some special characters such as an exclamation mark, can cause problems in the subject line / message line depending on single or double quotes used.

sendEmail -f megan.fox@movieworld.com -t MyEmail@gmail.com \
-u "Enjoyed meeting you at the party good-looking ;)" \
-m "We sure had a good time didnt we, cant wait to see you again .. " \
-s smtp.isp

















As received in gmail (this one got caught as being spam as I had tested it a few times in quick succession) ;

 

















Now my better half would never believe that I actually met Megan Fox at a party or that she was so thunderstruck by my charming self she thought it necessary to email me..
But hey, you get the idea ;)


USING STDIN FOR MESSAGE INPUT

If we want to be able to write a bit more in the email body, simply leave out the -m option, and sendEmail will read from STDIN, you will be prompted to enter a message after entering the command and then press Ctrl+D
(on its own line) to have it read and then sent ;
Lets use an example which the better halves will appreciate a bit more, like sending an email to your wife on Valentine's Day.. yeah...what a romantic..

sendEmail -f Secret.Admirer@secret.com -t BetterHalf@gmail.com \
-u "Will you be my valentine?" \
-s smtp.isp

You will then be presented with;
Reading message body from STDIN because the '-m' option was not used.
If you are manually typing in a message:
  - First line must be received within 60 seconds.
  - End manual input with a CTRL-D on its own line.

So type the desired message and when finished make sure you hit enter to get to a free / blank line, then
hit CTR+D ;
Roses are Red
Violets are Blue
Sugar is Sweet
And so are You !
Ctrl+D

















As received in gmail ;





















Now if that doesn't get an appreciative smile / freebie to grab another beer, then you must have really been snoring the night before..


SENDING EMAIL WITH MESSAGE PRE-PREPARED IN TXT FILE

You can also prepare a written message and have sendEmail enter this as the message body ;

nano valentine

Will you be my Valentine ?
===================
Roses are Red
Violets are Blue
Sugar is Sweet
And So Are You !

HAPPY VALENTINE'S DAY !

Save and Exit; Ctrl+X --> Y

sendEmail -f secret.admirer@secret.com -t BetterHalf@gmail.com \
-u "Will you be my valentine?" \
-o message-file=valentine \
-s smtp.isp

















As received in gmail ;























USING GMAIL'S SMTP FOR SENDING MAIL

In order to use gmail's smtp server, you have to specify your gmail username (with -xu) & password (with -xp).

An example herebelow ;

sendEmail -f DesiredEmail@whatever.com -t YourEmail@testaccount.com \
-u "Testing Gmail smtp" \
-m "Just a test for the gmail smtp" \
-s smtp.gmail.com \
-xu your.gmail@gmail.com \
-xp gmailpassword

When sending the message, the return address will always be your gmail account, also, the sent message will be stored in the gmail account being used.

Of course there are quite a few more options, adding cc's / bcc's, including attachments, etc etc.


Just a bit of fun, but goes to show that checking where certain emails come from is not a bad idea.


Especially if they include links to sites or attachments..
 
Google Analytics Alternative