Using sylpheed to send mail from the command line.

Using applications, configuring, problems
Post Reply
Message
Author
menno

Using sylpheed to send mail from the command line.

#1 Post by menno »

I like to send messages with sylpheed , from the command line .
Sorry I know it has been told before someware , but I cann't find it .
Can someone tel me how to do it ?

This is because I like to generate mail by a script .

Rich
Posts: 278
Joined: Wed 04 May 2005, 19:00
Location: Middlesbrough - UK

#2 Post by Rich »

from the command line, type sylpheed --help

This brings up the embedded commands needed.

'sylpheed --compose' and 'sylpheed --send' for example

( is that what you mean - or have I missed the point? ) :)


Rich

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#3 Post by Flash »

Thinking that menno meant he couldn't find sypheed in his version of Puppy, I opened rxvt and typed "sylpheed help." Boy, it's there, at least in Puppy 1.0.2. I forgot how much is involved in setting up an email account. :)

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

nc would probably work
you might need something like nail
http://nail.sourceforge.net/

menno

#5 Post by menno »

Thanks Flash , but it is working .
Thanks Rich , that was I where I was looking for .

I think GuestToo understand what I want . That is sending a eMail by a scriptprogram . I hoped that Sylpheed had a possebility to send a textfile in a way as 'mail' or MAPI does . 'mail <emailadres> <textfile> <attachfiles>' or something like that . I would not make PUPPY bigger and bigger , if posseble I would like to use the programs how are already in PUPPY .

Is it posseble ?

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#6 Post by GuestToo »

netcat (called nc in Puppy) might work
see the bottom of this page:
http://www.webservertalk.com/archive109 ... 02560.html

nail would be easier ... this deb might work
http://packages.debian.org/stable/mail/nail

menno

sending eMail

#7 Post by menno »

GuestToo thanks , that was a great help .
Have to send a mail to a mailserver is well documenten by :
http://cr.yp.to/smtp.html this is also found in RFC 2821 .
So start in console : nc <yourmailserver> 25 .
It wil welcom you . Give HELP and you will see the option your mailserver has .
Give QUIT to leave it .
Here is a script than can send a mail :

Code: Select all

#!/bin/sh
log=/dev/tty
smtp_server=your.mail.server
mkfifo /tmp/$$.out
hostname=localhost


read_response () {
 local status="" 
 while [ -z "$status" ] ; do
 read line < /tmp/$$.out
 case "$line" in
  [0-9]??' '*) status="$(echo "$line" | sed -e 's/^\(.\).*/\1/')" ;;
  [0-9]???*) true ;;
  *) echo "QUIT" ; sleep 3 ; exit 1 ;;
 esac
 done
 echo "$status"
}

error () {
 echo "RSET"
 if [ $(read_response) != "2" ] ; then echo "RSET Failed" > $log; fi
 echo "QUIT"
 if [ $(read_response) != "2" ] ; then echo "QUIT Failed" > $log; fi
 sleep 3
 exit 1
}

(
if [ $(read_response) != "2" ] ; then error ; fi
echo "HELO $hostname"
if [ $(read_response) != "2" ] ; then echo "HELO Failed" > $log; error ; fi
echo "MAIL FROM:<your.name@your.mail.server>"
if [ $(read_response) != "2" ] ; then echo "MAIL Failed" > $log; error ; fi
echo "RCPT TO:<your.frind@his.mail.adres>"
if [ $(read_response) != "2" ] ; then echo "RCPT Failed" > $log; error ; fi
echo "DATA"
if [ $(read_response) != "3" ] ; then echo "DATA Failed" > $log; error ; fi
echo "To: your.frind@his.mail.adres"
echo "Subject: testje"
echo ""
echo "iets zinnig zeggen"
echo "Eigenlijk nooit !"
echo "."
if [ $(read_response) != "2" ] ; then echo "Delivery Failed" > $log; sleep 3 ; exit 1 ; fi
echo "QUIT"
if [ $(read_response) != "2" ] ; then echo "Closed Failed" > $log; sleep 3 ; exit 1 ; fi
)| nc $smtp_server 25 > /tmp/$$.out
rm /tmp/$$.out
exit 0

#the way QUIT is send as response to a error leads to broken-pipe error in NC 
#therefore I changed it a little (menno).

#Thanks to Pascal J. Bourguignon <pjb@informatimago.com> for a LOT of
#help with the above. A great guy.
The real mail , inbetween DATA and the .(dot) has its own protocol most of it is publised in RFC 1521 . It seems to be wise to try it out on your mailserver because I saw that there is a big differrence in how they act to given information . How you eMail program(sylpheed,outlook) reacts to the RFC 1521 is very different .
I hope it helps some other people .

Post Reply