Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Nov 2014, 11:12
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
CLI SMTP mailer
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 4 Posts_count   Goto page: 1, 2, 3, 4 Next
Author Message
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Mon 30 Jul 2007, 08:58    Post_subject:  CLI SMTP mailer
Sub_title: tiny download
 

Dear Puppians,

I recently compiled a tiny command line SMTP mailer that you might find useful. It can send out plain text files as well as encoded binary attachments. You could use it, for example, to automate the sending out of "proprietary" TV sat codes available on a variety of web pages. In a series of scripts, you would use wget to grab a page with recent codes, parse them to grab the codes of interest, format them for your own purposes and send them out automatically to a few friends. All this could take place automatically at regular intervals using cron. What would be particularly pleasing is that you wouldn't have to open a web browser, inspect each page manually for what you want and load a mail client such as sylpheed to do the sending. The program is also useful for mailing notifications regarding system status (e.g. sending the results of "cat /var/log/messages | grep err").

There is an email.conf file in /usr/local/etc/email that requires editing before you can run this program. Simply indicate your SMTP server and login parameters etc. and away you go. If you want to have separate system-wide and personal configurations, copy email.conf to /root/.email.conf (notice the preceding dot) and make changes to the latter. The file in /root will override the global settings.

A sample script to launch email looks like this:

Code:

#!/bin/sh
p1="any_old_user@gmail.com"     # This is the "to address"
p2="-s This is my test subject" # This is the "subject"
p3="/tmp/mytext.txt"            # This is the plain text file to send as "body text"
email $p1 "$p2" < $p3


All those parameters you can change on the command line. There is a readme included and a manual page I also converted to html. Unpack the archive and have a look within /usr/local/doc/. If I get motivated, I'll write a little front-end gui and post it, but that would run counter to the entire purpose of the CLI, wouldn't it?

With kind regards,
vovchik
email_2.5.1.tar.gz
Description 
gz

 Download 
Filename  email_2.5.1.tar.gz 
Filesize  51.22 KB 
Downloaded  606 Time(s) 
Back to top
View user's profile Send_private_message 
faulkmore

Joined: 06 Sep 2007
Posts: 3

PostPosted: Thu 06 Sep 2007, 03:36    Post_subject: cli smtp email help request
Sub_title: compiled from src, but does not work.
 

I tested out the cli smtp email package on puppy v2.14. I compiled it from source instead of using the provided binary. The src can be downloaded from [url]email.cleancode.org[/url]

Installed ..... with .....
./configure --with-utc
make
make install

Editted the general configuration file for "email" located at /usr/local/etc/email/email.conf . Added just enough information so the darn should work:
* my name
* my email
* smtp server
* smtp port
* smtp login/password.

I attempted to send a test email from shell script.

Code:
strMsg="The Msg"
/usr/local/bin/email -s "${strMsg}" faulkmore@mydomainname.com "This message was generated by $0"


And got the following error:

************************************

email: FATAL: Could not connect to server: smtp1.mysmtpservername.net on port: 25: No route to host

Caught an ERROR, Shutting down...

************************************
No route to host?! No route to host?! But why not?! In the standard C library there is the method gethostbyname . When ./configure is run, it says gethostbyname is available. So why can't it figure out the host. Is there something i'm missing here. Does /etc/.host have to be edited somehow.

Is puppy missing something which is preventing "email" from working?

Any help would be most appreciated. I think this is a puppy issue and not a problem with the "email" software.

Kind Regards,
Dave
Back to top
View user's profile Send_private_message 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Thu 06 Sep 2007, 05:33    Post_subject: CLI SMTP mailer
Sub_title: working in my case
 

Dave,

I don't remember what configure parameters I used during compilation, but my version works on Puppy 2.10. I just tested it again and got the following message:
Code:
Sending  " This is my test..."  |*******************************| 100% of 487 Bytes
E-Mail Sent

Why don't you try my binary to see whether the "-with-utc" might be to blame. Also, try to run email -t, which performs a check on the email.conf config file.

With kind regards,
vovchik
Back to top
View user's profile Send_private_message 
faulkmore

Joined: 06 Sep 2007
Posts: 3

PostPosted: Sat 08 Sep 2007, 00:51    Post_subject: Foot in mouth
Sub_title: This is embarrassing, but deserves an explanation
 

'email' works perfectly. The broadband provider is blocking port 25, so we are forced to go thru their smtp server (blame server-side spam blacklists). This is why there is "no route". I knew this, but it slipped my mind. When a script is 98% done and only one thing isn't working....i'm sure we have all been there.

Thank you for your reply and i'll try to wait at least a day before I cry out for help next time.

I changed the smtp port 25->26 and everything worked perfectly.

Next step is to enchance parsing arguments and switches. It's just not sexy enough...But this is a different topic.

Thanks for your help!!

Kind Regards,
Dave
Back to top
View user's profile Send_private_message 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Sat 08 Sep 2007, 03:48    Post_subject: Thanks for your timely posting  

I used a small CLI email program like this several years ago for sending jpeg images captured using "motion", a linux video surveillance application, to my external email account. Now that I'm doing similar stuff again with "motion" on puppy linux, it was actually on my mind that I needed to look for such a CLI email program again (but couldn't remember what I used back then). I was thus very pleased to see your forum post vovchik! Thanks greatly, you've saved me a lot of time! Smile

Pity it doesn't use TLS though (so can't send to gmail). I have come across an alternative commandline email written in Perl; I'm hoping it will be able to work with gmail but haven't had time to test it yet. You'll find it at:

http://caspian.dotconf.net/menu/Software/SendEmail/

Yes, according to its website, SendEmail can use TLS and thus access gmail accounts.
Back to top
View user's profile Send_private_message Visit_website 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Sat 08 Sep 2007, 06:56    Post_subject: sendEmail seems to have perl-related problem on puppy  

Downloaded sendEmail and moved the perl executable to /usr/locl/bin as required. Ran it, but got error message. Unfortunately, I don't know Perl, so don't know what it means. Pity, because I think sendEmail has all the facilities I want. Anyone, able to help here? According to what I've now read, the error message means that the perl module Errno needs to be installed. I've found it at CPAN but now I need ExtUtils:MakeMaker to do the installing, and I need to use make to install that! I don't have any of that on my system at the moment. I'll need to download devx_xxx.sfs and take it from there!

SUCCESS! I downloaded devx_xxx.sfs (in my case devx_217.sfs) via my dialup connection overnight and when I rebooted my machine in the morning I found to my surprise that sendEmail was working without my needing to do anything else. All the missing modules were in devx_217.sfs! Not everyone probably wants to have to download devx_217.sfs just to get a commandline email program working though, so I may try and install the modules that were originally missing separately. If I manage that I'll post the details and a dotpet of everything required. Without devx_217.sfs, the error messages were as follows:

# sendEmail
Can't locate Errno.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8/i486-t2-linux-gnu /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i486-t2-linux-gnu /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i486-t2-linux-gnu /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl .) at /usr/lib/perl5/5.8.8/i486-t2-linux-gnu/IO/Socket.pm line 17.
BEGIN failed--compilation aborted at /usr/lib/perl5/5.8.8/i486-t2-linux-gnu/IO/Socket.pm line 17.
Compilation failed in require at /usr/local/bin/sendEmail line 39.
BEGIN failed--compilation aborted at /usr/local/bin/sendEmail line 39.

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Sat 08 Sep 2007, 13:07    Post_subject: sendEmail also works on my system  

mcewanw:

sendEmail works. Sorry that this reply isn't too helpful, but I managed to install it without too much head-scratching some time ago. Here's proof:
Code:
sendEmail-1.55 by Brandon Zehm <caspian@dotconf.net>

Synopsis:  sendEmail -f ADDRESS [options]

  Required:
    -f ADDRESS                from (sender) email address
    * At least one recipient required via -t, -cc, or -bcc
    * Message body required via -m, STDIN, or -o message-file=FILE

  Common:
    -t ADDRESS [ADDR ...]     to email address(es)
    -u SUBJECT                message subject
    -m MESSAGE                message body
    -s SERVER[:PORT]          smtp mail relay, default is localhost:25

  Optional:
    -a   FILE [FILE ...]      file attachment(s)
    -cc  ADDRESS [ADDR ...]   cc  email address(es)
    -bcc ADDRESS [ADDR ...]   bcc email address(es)
    -xu  USERNAME             username for SMTP authentication
    -xp  PASSWORD             password for SMTP authentication

  Paranormal:
    -b BINDADDR[:PORT]        local host bind address
    -l LOGFILE                log to the specified file
    -v                        verbosity, use multiple times for greater effect
    -q                        be quiet (i.e. no STDOUT output)
    -o NAME=VALUE             advanced options, for details try: --help misc
        -o message-file=FILE         -o message-format=raw
        -o message-header=HEADER     -o message-charset=CHARSET
        -o reply-to=ADDRESS          -o timeout=SECONDS
        -o username=USERNAME         -o password=PASSWORD
        -o tls=<auto|yes|no>         -o fqdn=FQDN

  Help:
    --help                    the helpful overview you're reading now
    --help addressing         explain addressing and related options
    --help message            explain message body input and related options
    --help networking         explain -s, -b, etc
    --help output             explain logging and other output options
    --help misc               explain -o options, TLS, SMTP auth, and more

root$ [~]->


I seem to recall that I had to install additional modules, perhaps socket::io (or something like that). I am running Puppy with devx installed, but even so, Puppy does not have a full implementation of Perl.

regards,
vovchik
Back to top
View user's profile Send_private_message 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Sat 08 Sep 2007, 23:08    Post_subject: Re: sendEmail also works on my system  

vovchik wrote:
mcewanw:

sendEmail works. Sorry that this reply isn't too helpful, but I managed to install it without too much head-scratching


No problem, vovchik. As I've since indicated in my post above, I discovered independently, when switching on my machine this morning, that sendEmail was already working (I had downloaded devx_217.sfs overnight whilst I slept!). I didn't need to add any extra modules at all - the missing ones were all in devx_217.sfs. Now I want to get it going without needing to have devx_217.sfs loaded at all. As I say, I'll produce a dotpet of the missing bits if I find the time and manage to sort it out.

Though I'm sure that djones's CLI email program from http://email.cleancode.org/, which you describe in your first post on this thread, is excellent, and requires no devx_xxx.sfs to be loaded, I think I'll be using sendEmail instead because I really need TLS support so that I can use gmail. Great that there are so many options though!
Back to top
View user's profile Send_private_message Visit_website 
vovchik


Joined: 23 Oct 2006
Posts: 1287
Location: Ukraine

PostPosted: Sun 09 Sep 2007, 06:09    Post_subject: sendEmail works well  

mcewan:

While email is not at all bad, it does, as you point out, lack TLS. I now tried sendEmail and discovered that I needed to install the following modules in order to get it to send via gmail:

Net_SSLeay.pm-1.30.tar.gz and
IO-Socket-SSL-1.08.tar.gz

Both modules are available from CPAN. They install without problems, provided the SSL lib versions match (instructions are in the README). In my case, an older version of Net_SSLeay (1.25) didn't work, so I had to get the updated version above.

My sendEmail command line for gmail looks like this:
Code:
sendEmail -f gmail_user@gmail.com -t recipient@some_isp.com -u subject_line -xu gmail_user@gmail.com -xp gmail_password -s smtp.gmail.com:587 -o tls=yes -o message-file=anyfile.txt

Sep 09 12:50:42 localhost sendEmail[27414]: Email was sent successfully!


Good luck with the dotpup or dotpet.

regards,
vovchik
Back to top
View user's profile Send_private_message 
MU


Joined: 24 Aug 2005
Posts: 13644
Location: Karlsruhe, Germany

PostPosted: Sun 09 Sep 2007, 07:15    Post_subject:  

you can install Perl-modules from comandline, at least if you have devx_2xx.sfs.
I don't know if it works without it.
http://www.murga-linux.com/puppy/viewtopic.php?p=34810#34810

So for Errno it might be:
perl -MCPAN -e 'install Errno'

This also should install dependencies.

If you get an error with the name "Errno", look for the correct name here:
http://search.cpan.org/

I entered "Errno" there, and the first link confirmed, that this is the correct name.


However a dotpup would be good, as using mcpan installs quite some MB of stuff (6 MB or so if I remember well), just to satisfy the dependencies of the installer itself.

A dotpup/Pet can be made, by adding the files with the typical name from /usr/lib/perl5/

Like
Errno.pm
Auto/whatever/Errno/stuff.txt

So files might be spread in several folders there.

Mark
Back to top
View user's profile Send_private_message Visit_website 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Sun 09 Sep 2007, 14:50    Post_subject: maybe tomorrow...  

Thanks for all that, vovchik and MU. I have to sleep now, but may get back to this tomorrow if my partner doesn't kill me for spending too much time with puppy linux recently...
Today I was sidetracked because of a thread on video editing (something I'm very interested in) - http://www.murga-linux.com/puppy/viewtopic.php?t=2425&start=15
I was recommending a very sophisticated non-linear video editing app called zs4 from www.zs4.net which is free for use, and for windows or linux. Since then I have downloaded it but, its a complex app, and I failed to get it to install on puppy out of the box. I suspect that will take some time so I'm hoping someone on that other thread will be tempted to take it on! Smile If they don't I'm sure I'll get back to that eventually, because I really need such an app and I don't want to rely on the windows version.
Back to top
View user's profile Send_private_message Visit_website 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Sun 09 Sep 2007, 22:54    Post_subject: no success, sigh...  

vovchik wrote:
mcewan:
. . . discovered that I needed to install the following modules in order to get it to send via gmail:

Net_SSLeay.pm-1.30.tar.gz and

IO-Socket-SSL-1.08.tar.gz
Both modules are available from CPAN. They install without problems, provided the SSL lib versions match (instructions are in the README). In my case, an older version of Net_SSLeay (1.25) didn't work, so I had to get the updated version above.
vovchik


[using Puppy Linux 2.17.1 and devx_217.sfs loaded]

Well... I went to CPAN and the version I found of Net-SSLEAY.pm was slightly different:

Net-SSLeay-1.32.tar.gz

Anyway, I decompressed it into a directory of its own (using Xarchive), had a quick read of the readme and ran, as that suggested:

Code:
 ./Makefile.PL -t


Apparently there were things missing because it asked:

Auto-install the 9 mandatory module(s) from CPAN? [y]

I just pressed enter and always accepted offered defaults.

At the end, the report said:

[Begin]
Warning: the following files are missing in your kit:
inc/Module/Install/PRIVATE/Net/SSLeay.pm
MANIFEST
README
TODO
Please inform the author.
Warning: prerequisite examples/*.0 0 not found.
Warning: prerequisite examples/cert.pem 0 not found.
Warning: prerequisite examples/key.pem 0 not found.
Warning: prerequisite examples/key.pem.e 0 not found.
Warning: prerequisite makecert.err 0 not found.
Warning: prerequisite makecert.out 0 not found.
Warning: prerequisite sslecho.log 0 not found.
Warning: prerequisite t/local/ptr_cast_test 0 not found.
Warning: prerequisite tcpecho.log 0 not found.
Writing Makefile for Net::SSLeay
[End]

Not knowing perl at all, I didn't have a clue, but forged ahead with:

Code:
 make


That went on for ages, apparently downloading the missing stuff from the net.

Alas, it all ended with the following error, which in the circumstances of my huge knowledge-hole leaves me lost:

[Begin]
chmod 755 blib/arch/auto/Net/SSLeay/SSLeay.so
cp SSLeay.bs blib/arch/auto/Net/SSLeay/SSLeay.bs
chmod 644 blib/arch/auto/Net/SSLeay/SSLeay.bs
Manifying blib/man3/Net::SSLeay.3
Can't open blib/man3/Net::SSLeay.3 for writing: Invalid argument
at /usr/lib/perl5/5.8.8/ExtUtils/Command/MM.pm line 132
make: *** [manifypods] Error 22
[End]

So I can't even make TLS work like alone make a dotpet of the whole sendEmail+TLS requirements! I give up on the latter for sure, it seems to me that there are many dependencies that would need to be included and, having a head full of sawdust when it comes to perl, I am not the right person to do it. Though I've been working with UNIX, to some extent, for almost 30 years, and am happy with bash, awk and sed, I have always avoided perl like the plague; I just can't stand the look of it (!) and can't be bothered amending my ways in that regard... If only python had been "invented" first!... Smile

Edited_time_total
Back to top
View user's profile Send_private_message Visit_website 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Mon 10 Sep 2007, 04:17    Post_subject: tried again afterall  

I was more awake and determined, so tried again afterall...

[all the following done on Puppy 2.17.1 with devx_217.sfs loaded]

This time I tried using CPAN.pm [thanks MU for tip], entering:

perl -MCPAN -e shell

then at cpan> prompt I entered: i Net::SSLeay
[that verified the module was available at CPAN]

Then I entered at cpan> prompt:
install Net:SSLeay

and cpan.pm started doing its business downloading everything. Alas, it ended with a similar error message as when I tried doing it all more manually with: ./Makefile.PL -t

With cpan.pm the error was:

[Begin error message]
System call "/usr/bin/wget -O - "ftp://ftp.perl.org/pub/CPAN/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz" > /root/.cpan/sources/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar"
returned status 1 (wstat 256)
Warning: expected file [/root/.cpan/sources/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz] doesn't exist
No external ftp command available

Please check, if the URLs I found in your configuration file () are valid.
The urllist can be edited. E.g. with 'o conf urllist push ftp://myurl/'

Could not fetch authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz
Giving up on '/root/.cpan/sources/authors/id/F/FL/FLORA/Net-SSLeay-1.32.tar.gz'
[End error message]

Then I downloader the earlier 1.30.tar.gz of Net_SSLeay, and tried installing it with: ./Makefile.PL -t
but it gave the same kind of errors too.

I can't see that I'm doing anything wrong! What gives? If only I could get this bit working I'd be encouraged to keep going. Any thoughts?
Back to top
View user's profile Send_private_message Visit_website 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: Mon 10 Sep 2007, 04:27    Post_subject: Re: maybe tomorrow...  

mcewanw wrote:
if my partner doesn't kill me for spending too much time with puppy linux recently....

You're not alone!!!
HairyWill wrote:
rarsa wrote:
Nathan F wrote:
I've developed a habit of stopping every thirty secons or so just to make sure she isn't glaring at me.
I thought it was just me!
Ahh but by that time its too late.

http://www.murga-linux.com/puppy/viewtopic.php?p=102932&search_id=1096136907#102932

_________________
Will
contribute: community website, screenshots, puplets, wiki, rss
Back to top
View user's profile Send_private_message 
mcewanw

Joined: 16 Aug 2007
Posts: 2349
Location: New Zealand

PostPosted: Mon 10 Sep 2007, 05:20    Post_subject: Re: maybe tomorrow...  

HairyWill wrote:

You're not alone!!!


One can but laugh (or perhaps that should be weep) Smile
Back to top
View user's profile Send_private_message Visit_website 
Display_posts:   Sort by:   
Page 1 of 4 Posts_count   Goto page: 1, 2, 3, 4 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1278s ][ Queries: 13 (0.0048s) ][ GZIP on ]