View previous topic :: View next topic |
Author |
Message |
dakster Apprentice
Joined: 26 Jul 2004 Posts: 178 Location: New England
|
Posted: Sun Jan 14, 2007 6:16 pm Post subject: ssmtp email from a script problems [SOLVED] |
|
|
I have a Linksys slug (arm based) running gentoo, and I'm trying to set up sending emails from scripts for this little embedded computer. I've set up a gmail account for this computer and emerged ssmtp successfully. My ssmtp.conf file consists of:
root=postmaster
mailhub=smtp.gmail.com:465
UseTLS=YES
And the command I'm using is:
(echo "Subject: foo sub"; echo; cat testEmail) | ssmtp -au "USERNAME" -ap "PASSWORD" "myemail@gmail.com"
This command proceeds to hang indefinitely. The error I'm getting in my /var/log/messages is:
Jan 14 12:51:15 bubo sSMTP[6906]: Unable to set UseTLS="YES"
This pops up immediately in the log when I execute the command. Any tips? I don't know anything about mail systems to be honest, I'm sure it's something simple, but googling hasn't turned up anything....
Last edited by dakster on Fri Jan 19, 2007 3:06 pm; edited 1 time in total |
|
Back to top |
|
|
ecosta Guru
Joined: 09 May 2003 Posts: 477 Location: Brussels,BE
|
Posted: Sun Jan 14, 2007 6:49 pm Post subject: |
|
|
I've had a few probs with ssmtp so I changed to msmtp and now I am happy
This is what I have incase you dicide to give it a go
~/.msmtprc
account <accountname>
host <mailserverip>
from <user@domain.com>
In .muttrc I just set the following
set sendmail="/usr/bin/msmtp -a <accountname>"
Then just email and forget about it...
$ mutt -s "TEST" john@doe.com
Hope this helps
-Ed _________________ Linux user #201331
A8N-SLI Delux / AMD64 X2 3800+ / 1024 MB RAM / 5 x 250 GB SATA RAID 1/5 / ATI Radeon X700 256MB. |
|
Back to top |
|
|
dakster Apprentice
Joined: 26 Jul 2004 Posts: 178 Location: New England
|
Posted: Sun Jan 14, 2007 9:14 pm Post subject: |
|
|
Hmm, that mutt command seems to be an interactive command, which won't work for scripting. I'm trying now to just use msmtp, but so far it's just sitting there. Anyone know the syntax for a command line email using msmtp? |
|
Back to top |
|
|
ecosta Guru
Joined: 09 May 2003 Posts: 477 Location: Brussels,BE
|
Posted: Wed Jan 17, 2007 8:16 am Post subject: |
|
|
Sorry for late reply,
You can use it in a script, I do it all the time. This is what I have on my boxes:
Code: |
# ls -ld `which sendmail`
lrwxrwxrwx 1 root root 14 2007-01-06 12:10 /usr/sbin/sendmail -> /usr/bin/msmtp
|
The fact that sendmail is a link to msmtp should fix any probs you may have.
and for msmtp, I use what I gave you before.
Quote: |
~/.msmtprc
account <accountname>
host <mailserverip>
from <user@domain.com>
|
I personaly use nail to send my mail and it works fine in scripts, but mailx, mutt, ... will also work fine.
Code: |
nail -s "TEST" jdoe@example.com < /dev/null
|
Hope this helps,
-Ed _________________ Linux user #201331
A8N-SLI Delux / AMD64 X2 3800+ / 1024 MB RAM / 5 x 250 GB SATA RAID 1/5 / ATI Radeon X700 256MB. |
|
Back to top |
|
|
ecosta Guru
Joined: 09 May 2003 Posts: 477 Location: Brussels,BE
|
Posted: Wed Jan 17, 2007 8:33 am Post subject: |
|
|
Just realised you where using TLS... this is what I did to get TLS working
~/.msmtprc
Code: |
# Set default values for all following accounts.
defaults
tls on
tls_trust_file ~/.msmtp/certificate
logfile ~/.msmtp/msmtp.log
# foobar
account foobar
host mail.domain.com
from jdoe@gmail.com
auth on
user jdoe@gmail.com
password <mypassword>
# Set a default account
account default : foobar
|
This is a list of files and permissions
Code: |
# ls -lR .msmtp*
-r-------- 1 root root 361 2006-11-14 14:13 .msmtprc
.msmtp:
total 92
-r-------- 1 root root 1310 2006-11-14 13:48 certificate
-r-------- 1 root root 85403 2007-01-17 09:31 msmtp.log
|
cat certificate
Code: |
-----BEGIN CERTIFICATE-----
M11DmTCCAwKgAwIBAgIJAKauzKQtCzZfMA0GCSqGSIb3DvEBBQUAMIGQMQsWCQYD
...
lD7gsCT/OOOX7veBMy==
-----END CERTIFICATE-----
|
_________________ Linux user #201331
A8N-SLI Delux / AMD64 X2 3800+ / 1024 MB RAM / 5 x 250 GB SATA RAID 1/5 / ATI Radeon X700 256MB. |
|
Back to top |
|
|
thuk n00b
Joined: 26 Oct 2005 Posts: 31 Location: Canberra, Australia
|
Posted: Wed Jan 17, 2007 10:56 am Post subject: |
|
|
Hi There,
I'm using ssmtp with secure authentication as I think you want to. You might try adding a few extra lines to your ssmtp.conf:
Code: | useSTARTTLS=YES
AuthUser=mailuser
AuthPass=mailpass |
(change the user/pass to your gmail user/pass)
Hope this helps!
thuk |
|
Back to top |
|
|
dakster Apprentice
Joined: 26 Jul 2004 Posts: 178 Location: New England
|
Posted: Wed Jan 17, 2007 1:23 pm Post subject: |
|
|
Thanks for the tips, I'll give 'em a try tonight when I get home. |
|
Back to top |
|
|
dakster Apprentice
Joined: 26 Jul 2004 Posts: 178 Location: New England
|
Posted: Fri Jan 19, 2007 12:45 am Post subject: |
|
|
Hmm, I tried the ssmtp route, my config file (/etc/ssmtp/ssmtp.conf) is now:
root=postmaster
mailhub=smtp.gmail.com:465
UseTLS=YES
UseSTARTTLS=YES
AuthUser=(my account name)
AuthPass=(my password)
and I'm getting these errors in my logs:
Jan 18 19:49:45 bubo sSMTP[10529]: Unable to set UseTLS="YES"
Jan 18 19:49:45 bubo sSMTP[10529]: Unable to set UseSTARTTLS="YES"
I added a use flag "tls" and recompiled, nothing. Any ideas on this ssmtp before I switch over to msmtp? ssmtp seems simpler to me, I was hoping to get it working.... |
|
Back to top |
|
|
thuk n00b
Joined: 26 Oct 2005 Posts: 31 Location: Canberra, Australia
|
Posted: Fri Jan 19, 2007 11:45 am Post subject: |
|
|
Check some of the other posts on the forum. Some ones to start with:
TIP: gmail and ssmtp
HOWTO ssmtp
I don't actually use ssmtp with gmail, but I would have assumed gmail would be similar to any other secure ssmtp host. From first glance try:
Code: |
root=postmaster
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
AuthUser=(my account name)
AuthPass=(my password)
FromLineOverride=YES
|
Cheers,
thuk |
|
Back to top |
|
|
oxffffff n00b
Joined: 07 Nov 2005 Posts: 29
|
Posted: Fri Jan 19, 2007 12:46 pm Post subject: |
|
|
Did you compile ssmtp with the ssl USE flag turned on?
It will pull in openssl, but I think this is needed if you want to use TLS.
PS: as "emerge -pv ssmtp" will show you, there is no "tls" USE flag.
PPS: assuming you are using uclibc on the slug and not glibc, you will be hit by bug #145456. See there for a patch that still awaits being applied. |
|
Back to top |
|
|
dakster Apprentice
Joined: 26 Jul 2004 Posts: 178 Location: New England
|
|
Back to top |
|
|
|