maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   mailcmd - send email from commandline (https://talk.maemo.org/showthread.php?t=82918)

nicolai 2012-03-08 22:36

mailcmd - send email from commandline
 
http://maemo.org/packages/view/mailcmd/
Hi,
this is a simple command line utility to send
emails.
It uses your default email account from your
email applications (modest).
To send an email just enter the email subject,
receiver address(es) and type in your message
(finish up with ctrl+d). Examples:

mailcmd -s subject recipients
your message

or

echo "your message" | mailcmd recipients

If you have configured modest for autoupdate, the message
is sent the next time you are online. Otherwise it stays in your
outgoing folder until you push "send/receive" (in modest).

nicolai

szopin 2012-03-08 22:56

Re: mailcmd - send email from commandline
 
Wonder if this can be achieved with a script and telnet to smtp port (25?), would also allow you to send as bill.gates@microsoft.com, sent yesterday if you find a server that doesn't require encryption (good old times).

qwazix 2012-03-08 23:04

Re: mailcmd - send email from commandline
 
I would prefer to send one as elop@nokia.com with subject release the N950 worldwide

szopin 2012-03-08 23:09

Re: mailcmd - send email from commandline
 
Elop/BG, not much difference. You could send as obama@whitehouse.gov (there are websites that still allow you to do it, one of the funny things to do with telnet years ago, now most servers require authentication/encryption).
obama@whitehouse.gov wrote:
Stephen for god's in which we trust sake: release the N950 now!

nicolai 2012-03-10 09:48

Re: mailcmd - send email from commandline
 
New version (0.02)
- finds default email account, even if they contain whitespaces (like "Mail for Exchange")
- add an option "-a" for attachments
(echo "message" | mailcmd -a /fullpath/to/file -s subject adress(es)

nicolai

impeham 2012-11-18 18:16

Re: mailcmd - send email from commandline
 
I don't why, but mailcmd is giving me "segmentation fault" when i try to use it.

This is the command i'm using:

echo "test" | mailcmd myemail@gmail.com

nicolai 2012-11-18 19:38

Re: mailcmd - send email from commandline
 
works for me.
Do you have a mail account defined?

impeham 2012-11-18 20:17

Re: mailcmd - send email from commandline
 
yes of course - it also worked the last time i used it ~a week ago and this started happening for some reason

impeham 2012-11-18 20:21

Re: mailcmd - send email from commandline
 
i just tried to run the same command from an SSH client (my pc) and it worked fine!

the segmentation issue only happens if i run it from x-term on the device itself - strange

lonk 2013-01-13 22:24

Re: mailcmd - send email from commandline
 
is it possible to send multiple attachment?

I can send with one but not more than that

bozoid 2013-01-14 06:40

Re: mailcmd - send email from commandline
 
last i tried, there was a difference if one ran it as root or as user user.
also, might need run-standalone.sh?
cant remember but it was trivial (tho it seg faulted) so i ignored it.
but issue lies around there last i recall.

kh

nicolai 2013-01-14 19:40

Re: mailcmd - send email from commandline
 
1 Attachment(s)
It now supports multiple "-a FILE" commandline arguments
for attachments.

And think I found the reason why it segfaults sometimes.

Attached the new version 0.0.5-debfile (garage and/or autobuilder
is down)

solbrit 2013-02-12 00:35

Re: mailcmd - send email from commandline
 
When installing I get
Code:

Package mailcmd: File '/usr/bin/mailcmd' not in digsigsums -- warning
No digsigsums file

I take it this is not good. Any attempt to send mail will give segmentation fault...

nicolai 2013-02-12 19:23

Re: mailcmd - send email from commandline
 
I had no problems installing the deb file.
From commandline and with the application manager.
Where did you get that message?

And it works without segfaulting.

Do you have an email-account in modest, and
what was the exact command?

regards
Nicolai

ade 2013-02-12 20:12

Re: mailcmd - send email from commandline
 
Smells like an N9 message.. this is for a N900 :p

solbrit 2013-02-12 20:31

Re: mailcmd - send email from commandline
 
Indeed it is, and how wrong I was ;) Couldn't this be ported to the N9 by some kind soul...?
Thanks!

Edit: Installed beautifully on the N900 :p

mr_pingu 2013-02-12 22:19

Re: mailcmd - send email from commandline
 
Where I can find full manpage of this?

I have like 4 accounts configured in modest is there an option to select an account to send from?
Also, probably more related to general terminal but how to go one line back and/or delete a line if you spotted a mistake or pressed enter too much :P

Other than that it is working totally fine, and have not experienced a segfault yet.

nicolai 2013-02-12 23:04

Re: mailcmd - send email from commandline
 
Quote:

Originally Posted by mr_pingu (Post 1322730)
Where I can find full manpage of this?

"mailcmd -h" :-)

Quote:

Originally Posted by mr_pingu (Post 1322730)
I have like 4 accounts configured in modest is there an option to select an account to send from?

No.

Quote:

Originally Posted by mr_pingu (Post 1322730)
Also, probably more related to general terminal but how to go one line back and/or delete a line if you spotted a mistake or pressed enter too much :P

It is easier to use an editor in xterm and after composing
your text send it with mailcmd:

cat textfile | mailcmd ....

Quote:

Originally Posted by mr_pingu (Post 1322730)
Other than that it is working totally fine, and have not experienced a segfault yet.


Nicolai

mr_pingu 2013-02-12 23:20

Re: mailcmd - send email from commandline
 
Quote:

Originally Posted by nicolai (Post 1322735)
"mailcmd -h" :-)

I figured that one out :D Thought there would be more hidden...
Quote:

Originally Posted by nicolai (Post 1322735)
No.

Are you planning to add support for that?

Quote:

Originally Posted by nicolai (Post 1322735)
It is easier to use an editor in xterm and after composing
your text send it with mailcmd:

cat textfile | mailcmd ....

Thanks for the tip :)

bozoid 2013-02-14 04:30

Re: mailcmd - send email from commandline
 
Quote:

Originally Posted by mr_pingu (Post 1322730)
Where I can find full manpage of this?

I have like 4 accounts configured in modest is there an option to select an account to send from?
Also, probably more related to general terminal but how to go one line back and/or delete a line if you spotted a mistake or pressed enter too much :P

Other than that it is working totally fine, and have not experienced a segfault yet.

I didn't try it with mailcmd, but I'm sure you could work something out based on this:
seq 1 10 | vim -
.. inside vim, pres Esc & type following:
:w !sed -e 's/^/MailLine/'

In actual, you'd actually only run vim without a filename, type the mail content, press Esc, and type :w !mailcmd someone@somewhere.com.

More info here:
http://www.softpanorama.org/Editors/...m_piping.shtml

kh

sebar 2015-11-28 14:56

Re: mailcmd - send email from commandline
 
I love mailcmd - thank you so much for building it!

It's exactly what I needed to let my N900 work as a neat home agent in the background. It's stting on my bedside table as an alarm clock and internet radio while downloading torrents. Since I want it to run on battery every now and then to keep the battery trained I wrote some scripts and have them read the battery state periodically with fcrontab. E-mailing them periodically (also with fcrontab) from the N900 gives me the the kick I need as the control freak I became quenching every little possibility out of that awesome little device. "Hi, it's your N900. The current battery state is 17%. You should charge me soon or I cannot wake you up tomorrow." :)

Spaß beiseite. I managed to attach the battery report to the e-mails as a textfile. Which, I must say, cost me HOURS at several nights and as only a part-time nerd I'm a little proud of ;). But of course you always want more. Why? Because SOMEHOW IT MUST BE POSSIBLE!". The thing is that in the periodically received mails I still have to open the attachment to see the report. Which is a little unpractical.

And now my question - is it possible to write pieces of a textfile into the subject field of the e-mail? Then you saw the battery state without opening the mail!

The battery report is of course only one example of what you could be mailing. Running processes, camera pictures, internet connection, disk space and torrent reports would also be nice...

sebar 2016-01-26 11:17

Re: mailcmd - send email from commandline
 
I've started to use an alternative solution. The pipe before the command can be used to put any kind of output into the e-mail. Many e-mail clients display the beginning of the mail already in their overview of the inbox. This can be used to conveniently view status messages sent by mailcmd.

Still wondering how you can put one into the subject field, though...

Cheers!


All times are GMT. The time now is 08:04.

vBulletin® Version 3.8.8