Hello Forum!
Browsing through the few mail threads about sending emails from a script I have concluded that mailx and msmtp should be a good solution for Tiny Core.
I have installed both extensions and last night I actually managed to establish a connection from msmtp to google. This is what I did:
I copied the Equifax_Secure_CA.pem from here ->
http://www.andrews-corner.org/mutt.html to here -> /home/tc/.certs/Equifax_Secure_CA.pem
I created a basic msmtp config file with user rw only perrmissons here -> /home/tc/.msmtprc
And now I am quite proud to actually be able to do this:
tc@suxi:~$ msmtp --debug --from=myaccount@gmail.com destination@mail.com
ignoring system configuration file /usr/local/etc/msmtprc: No such file or directory
loaded user configuration file /home/tc/.msmtprc
account chosen by envelope from address myaccount@gmail.com: provider
using account provider from /home/tc/.msmtprc
host = smtp.gmail.com
port = 25
timeout = off
protocol = smtp
domain = localhost
auth = choose
user = myaccount@gmail.com
password = (not set)
passwordeval = (not set)
ntlmdomain = (not set)
tls = on
tls_starttls = on
tls_trust_file = /home/tc/.certs/Equifax_Secure_CA.pem
tls_crl_file = (not set)
tls_fingerprint = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = on
tls_force_sslv3 = off
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = myaccount@gmail.com
dsn_notify = (not set)
dsn_return = (not set)
keepbcc = off
logfile = /home/tc/.msmtp.log
syslog = (not set)
aliases = (not set)
reading recipients from the command line
<-- 220 mx.google.com ESMTP bc2sm7070664wib.0
--> EHLO localhost
<-- 250-mx.google.com at your service, [xxx.xxx.xxx.xxx]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-STARTTLS
<-- 250 ENHANCEDSTATUSCODES
--> STARTTLS
<-- 220 2.0.0 Ready to start TLS
TLS certificate information:
Owner:
Common Name: smtp.gmail.com
Organization: Google Inc
Locality: Mountain View
State or Province: California
Country: US
Issuer:
Common Name: Google Internet Authority
Organization: Google Inc
Country: US
Validity:
Activation time: Fri Nov 18 01:57:17 2011
Expiration time: Sun Nov 18 02:07:17 2012
Fingerprints:
SHA1: F3:92:AE:B4:28:FE:64:03:6F:E1:55:ED:71:9E:5F:F6:88:90:5A:57
MD5: 27:71:5C:5E:A7:D5:2B:03:9E:2F:7E:7E:1A:1B:75:A9
--> EHLO localhost
<-- 250-mx.google.com at your service, [xxx.xxx.xxx.xxx]
<-- 250-SIZE 35882577
<-- 250-8BITMIME
<-- 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2
<-- 250 ENHANCEDSTATUSCODES
password for myaccount@gmail.com at smtp.gmail.com:
--> AUTH PLAIN AG1hcmMuc3V4ZG9yZkBnbWFpbC5jb20AZ21haWwxMjM=
<-- 235 2.7.0 Accepted
--> MAIL FROM:<myaccount@gmail.com>
<-- 250 2.1.0 OK bc2sm7070664wib.0
--> RCPT TO:<destination@mail.com>
<-- 250 2.1.5 OK bc2sm7070664wib.0
--> DATA
<-- 354 Go ahead bc2sm7070664wib.0
Unfortunately now I am stuck and I didn't find any "easy read" about mailx configuration. Do I have to create a mailx configuration file? Why do I need mailx in the first place? Can't I somehow tune msmtp to continue with process of sending a mail? I tried to enter some smtp commands after google's last <-- 543 Go ahead answer but that didn't work.
When I issue a mailx comand with basic parameters the command just gets stuck. I don't get any output whatsoever. I didn't find anything about a mailx debug mode and I also don't understand how mailx communicates with msmtp and whether and how this needs to be configured.
As always thank you for your help. A few weeks ago I didn't know a thing about Linux and thanks to Tiny Core and this Forum I am really getting into this
Best wishes
suxi
EDIT: I finally found
this article, which explaines my missing puzzle piece. And now it works like a charm!
I just had to create the following mailx config file: /home/tc/.mailrc
# gmail account (default)
# $ mailx -s "subject line" -a /path/attachment recipient@email.com < /path/body.txt
set from="YOURNAME@gmail.com (YOURNAME)"
set sendmail="/usr/local/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"