Le 29/06/2010 14:24, Refr Bruhl a écrit :


Good Morning

I am in need of of a mail program similar to the mail found in AIX. I am 
emulating an AIX environment.

I've installed the email, ssmtp and other email apps in the email. I get a 
segmentation fault for email

I like email as it seems to accept the same parameters and funcitonality as the 
AIX mail app. I have a multitude of scripts that use the format:

          echo ${MESSAGE} | mail -s '${SUBJECT}' ${EMAIL}

Where ${EMAIL} is a comma delimited list of addresses.

I've compiled the mailutils from gnu but I get a different error there which 
I'll take up with the buildlist-mailut...@gnu.org

which error ?

Anyone got any ideas on how to get email to work without a segmentation fault?

ah! this one ? do you know the origin ?

Where can I obtain the source for email? I've pretty much hit cygwin head first 
and am not as familiar with it as I am with AIX. My apologies for the newbie 
questions.

let's try ssmtp w/ /etc/ssmtp/ssmtp.conf configured like this :

mailhub=smtp.<isp>
FromLineOverride=YES
hostname=smtp.<isp>
rewriteDomain=<domain>
root=postmaster
AuthUser=<user>
AuthPass=<pass>
AuthMethod=LOGIN

and w/ /etc/ssmtp/revaliases :

<login>:<email>:smtp.<isp>

don't forget to run ssmtp-config

alternative w/ msmtp and /etc/msmtprc :

account <isp>
host smtp.<isp>
auth login
password <pass>

account <email1> : <isp>
from <email1>
user <user1>

account <email2> : <isp>
from <email2>
user <user2>

account default : <email1>

don't forget to run msmtp-config

yet another alternative w/ email :

/usr/bin/email \
-r smtp.<sip> \
-m LOGIN \
-u <user> \
-i <pass> \
-n "<comment>" \
-f <email> \
...

then, for both ssmtp/msmtp, the attached script should work !

I left you the implementation of the -a (attachment) option :-)

Regards,

Cyrille Lefevre
--
mailto:cyrille.lefevre-li...@laposte.net
#!/usr/bin/ksh
usage () {
echo 'usage: mailx [-dv] [-F name] [-r from] [-s subject]
             <-t | [-b bcc] [-c cc] [to...]>
at least one of -t, -b, -c or to... must be specified.' >&2
        exit $1
}
sendmail='/usr/sbin/sendmail'
bcc= bccsep='BCC: '
cc= ccsep='CC: '
name= namesep='-F '
from= fromsep='-f '
subject='(no subject)' subjectsep='Subject: '
debug= toopt= verbose=
undisclosed='undisclosed-recipients:;'
while getopts 'b:c:dF:hr:s:tv' c; do
case ${c} in
'b')    bcc="${bcc}${bccsep}${OPTARG}"; bccsep=',' ;;
'c')    cc="${cc}${ccsep}${OPTARG}"; ccsep=',' ;;
'd')    debug='-d' ;;
'F')    name="${namesep}'${OPTARG}'" ;;
'h')    usage 0 ;;
'r')    from="${fromsep}'${OPTARG}'" ;;
's')    subject="${OPTARG}" ;;
't')    toopt='-t' ;;
'v')    verbose='-v' ;;
*)      usage 1 ;;
esac
done
shift $(($OPTIND-1))
nl='
'
toarg= to= tosep=
if [[ -n ${toopt} ]]; then
        cc= bcc=
else
        if [[ $# = 0 ]]; then
                if [[ -n ${cc}${bcc} ]]; then
                        set -- "${undisclosed}"
                else
                        usage 1
                fi
        else
                for arg; do toarg="${toarg}${tosep}'${arg}'"; tosep=' '; done
        fi
        tosep='To: '
        for arg; do to="${to}${tosep}${arg}"; tosep=','; done
        [[ -n ${to} ]] && to="${to}${nl}"
        [[ -n ${cc} ]] && cc="${cc}${nl}"
        [[ -n ${bcc} ]] && bcc="${bcc}${nl}"
fi
[[ -n ${subject} ]] && subject="${subjectsep}${subject}${nl}"
read -r line
nl1="${nl}"
nl2=
case ${line} in
*':'*)
        case ${line%%:*} in
        *' '*)
                ;;
        *)
                nl1= nl2="${nl}"
                ;;
        esac
        ;;
'')
        nl1= nl2=
        ;;
esac
if [[ -n ${debug} ]]; then
        sendmail=sendmail
        sendmail () { echo sendmail "$@"; cat; }
fi
eval ${sendmail} ${toopt} ${verbose} ${name} ${from} ${toarg} << EOF
${subject}${to}${cc}${bcc}${nl1}${line}${nl2}$(cat)
EOF
#!eof

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to