Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just want to send a mail automatically on clicking an icon. I want to Attach Ping and Trace Report automatically with time stamp to some of the Email Address with some text in the message body. Is it possible ? I am using thunderbird as my email client with ubuntu 10.10.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

You could set up the console mailer "postfix".

sudo apt-get install postfix mailutils libsasl2-modules

Depending on what you need and what mail provider you're using, you'll have to do some configuration. The process is described here: https://help.ubuntu.com/community/PostfixBasicSetupHowto#Install%20Postfix . If you happen to speak German there is a more user friendly article: http://wiki.ubuntuusers.de/postfix

Then create a shell script from the template:

#!/bin/bash
pingreturn=$(ping -c 1 google.com)
echo "text in email: $pingreturn" | mail -s "Some Subject" a.b@c.de

This will send the mail "text in email: " followed by the return of the ping command to the address "a.b@c.de" with the sucject "Some subject".

With a launcher for that script you got your one-click mail. Shoudn't be terribly hard. Might be overkill though.

share|improve this answer
add comment

We do this by using a script and mutt (sudo apt-get install mutt) as command line mail client. It is one of few command line mail clients that can use attachments. Plus afaik it does not need any setting up: it uses the currently active mail setup.

As an example you could make a script with a ping and a mail with an attachment and a mailbody(with the same information) like this:

ping www.google.nl -c 4 > {attachment}
ping www.google.nl -c 4 > {/dir/to/mailbody}
mutt {mailadress} -s {subject} -a {attachment} -c {cc} -b {bcc} < {/dir/to/mailbody}

And the launcher, icon or a link or what ever you want this to activate it just needs to launch the script.

share|improve this answer
    
mutt is a bit bulky and hard to configure. but it can send attachments. If it's enough to just include the ping in the text body, then i'd not use mutt. –  con-f-use May 17 '11 at 12:44
    
@con-f-use he wants tracert too and ping output could be rather long that's why I opted for mutt. But it good to have choices :-) –  Rinzwind May 17 '11 at 13:10
    
I meant no offence. I like mutt too, and your comment for that matter :) –  con-f-use May 17 '11 at 14:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.