WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Sending emails  (Read 6592 times)

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Sending emails
« on: October 21, 2014, 12:43:31 AM »
Hi Guys,

Anyone know know how to send emails in TC?
Normally Busybox has sendmail built-in, but not in the 1.22.1 RPi version!

Been using Python but that means I need to install it and all it's dependencies.
There is Claws-mail and Fetchmail but these are clients?

It is for an embedded application and I want to send emails twice a day and also if an alarm condition occurs.
Was thinking it could be a simple cron job calling bash scripts.

Offline Lee

  • Hero Member
  • *****
  • Posts: 645
    • My Core wiki user page
Re: Sending emails
« Reply #1 on: October 21, 2014, 01:41:29 AM »
Quote
Anyone know know how to send emails in TC?

On the x86 platform, I wrote a little console mail utility script ('mx", the "mail experiment") that uses something like the following:
Code: [Select]
mailx -n -v -r <senderemail@domain.com> -s "<mail subject>" -S smtp-auth-user=<senderemail@domain.com> -S <senderssmtppassword> -S smtp=<smtp.domain.com:587> <recipient@domain.net>
It requires mailx.tcz and, I think, msmtp.tcz

Sending was an afterthought as my script was mainly for reading mail from a pop3 server, so the sending capability isn't all that polished.  It takes the message body from stdin, so you'd have to use redirection to use it in a script... or read up on the mailx command line options - I'm sure there's one to take the message body from a file.  At some point I'll look into it further as sending mail from a script is on my todo list, but it won't be this week, and probably not any time really soon.
32 bit core4.7.7, Xprogs, Xorg-7.6, wbar, jwm  |  - Testing -
PPR, data persistence through filetool.sh          |  32 bit core 8.0 alpha 1
USB Flash drive, one partition, ext2, grub4dos  | Otherwise similar

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sending emails
« Reply #2 on: October 21, 2014, 01:45:26 AM »
At the moment no MTP in the repo. I will add one, msmtp and/or nullmailer in the next days.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sending emails
« Reply #3 on: October 21, 2014, 05:00:29 AM »
msmtp.tcz added to repo
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Sending emails
« Reply #4 on: October 21, 2014, 05:16:38 PM »
msmtp.tcz added to repo

Thanks bmarkus  :D

Code: [Select]
$ msmtp --help
msmtp: error while loading shared libraries: libgsasl.so.7: cannot open shared object file: No such file or directory

Is there a dependency missing? I'm using piCorePlayer if that matters.

regards
Greg
« Last Edit: October 21, 2014, 05:27:14 PM by Greg Erskine »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Sending emails
« Reply #5 on: October 21, 2014, 08:47:21 PM »
Hi Greg Erskine
Is there a  libgsasl.tcz  in the repository?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sending emails
« Reply #6 on: October 22, 2014, 01:27:44 AM »
Hi Greg Erskine
Is there a  libgsasl.tcz  in the repository?

Yes it is there. Somehow the msmtp.tcz.dep file is missing, I will fix it. Load libgsasl.tcz manuall from the repo.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: Sending emails
« Reply #7 on: October 22, 2014, 02:51:16 AM »
Yes it is there. Somehow the msmtp.tcz.dep file is missing, I will fix it. Load libgsasl.tcz manuall from the repo.

Thanks. That fixed it.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sending emails
« Reply #8 on: November 06, 2014, 01:47:51 AM »
Must be doing something wrong.

Copied msmtp + libgsasl + libidn files into the tce/optional directory.
Added a msmtp.tcz.dep file to include libgsasl
Put msmtp.tcz into onboot
msmtp still says "error while loading libgsasl.so.7: ....

Used 7-zip to check the tcz files in Windows to find out where their go in TC. /usr/local/bin etc
Seem to be were they are supposed to be.

libidn.tcz does not seem to be an archive, 7-zip tells me?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sending emails
« Reply #9 on: November 06, 2014, 01:59:12 AM »

Used 7-zip to check the tcz files in Windows to find out where their go in TC. /usr/local/bin etc
Seem to be were they are supposed to be.

libidn.tcz does not seem to be an archive, 7-zip tells me?

.tcz files are squash files, 7zip do not knows them. Use linux to uncompress, looopmount them or better to use TC app browsers, like 'tce' in a terminal window to get list of their content.

Please read the Core book http://distro.ibiblio.org/tinycorelinux/corebook.pdf

« Last Edit: November 06, 2014, 02:02:33 AM by bmarkus »
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sending emails
« Reply #10 on: November 06, 2014, 02:27:35 AM »
Hi bmarkus,

My TC RPi's are on a device network behind a firewall.
So I'm doing everything via ssh and sftp.

Only use Windows 7-Zip to check *.tcz files on my Tinycore folder.

Command line mail out I thought would be easy as sys admins have been doing it since year dot.
I think they use sendmail now?

google example

echo "$line" | mail -s subject "$email"

http://theos.in/shell-scripting/send-mail-bash-script/
http://superuser.com/questions/384499/how-is-mail-actually-sent-when-i-use-the-linux-mail-command

The trick with RPi TC is to find what is already in the tcz mirror that can do what I want.


Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sending emails
« Reply #11 on: November 06, 2014, 03:13:36 AM »
Busybox has a utility ssmtp
http://www.busybox.net/tinyutils.html
Got the armhf.deb and tried the binary but got bitten by missing library.

Think I need to figure out how to make tcz from armhf.debs for the RPi.




Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Sending emails
« Reply #12 on: November 06, 2014, 03:32:34 AM »
Busybox has a utility ssmtp
http://www.busybox.net/tinyutils.html
Got the armhf.deb and tried the binary but got bitten by missing library.

Think I need to figure out how to make tcz from armhf.debs for the RPi.

Better to build it on piCore instead of playing with 3rd-party imported packages. Also, msmtp is in the repo and it works. Try.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sending emails
« Reply #13 on: November 06, 2014, 08:09:42 PM »
I did try msmtp but I had to manually install it, didn't work
Will try normal tce-load once I get past the firewall.

Offline gavinmc42

  • Sr. Member
  • ****
  • Posts: 301
Re: Sending emails
« Reply #14 on: November 07, 2014, 01:04:20 AM »
OK internet connected
using ozzie mirror  tinycore.mirror.uber.com.au

msmtp.tcz , libgsasl, libidn installed
tried sending emails,
got message need libiconv.tcz - ouch 1.2MB

Expanded partition to 20MB
tried tce-load -wi libiconv.tcz and got checksum did not match

now what?

learning lots:)