www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/06/29/22:49:48

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SARE_FREE_WEBM_LAPOSTE,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
Message-ID: <4C2AB0BC.9030306@laposte.net>
Date: Wed, 30 Jun 2010 04:49:32 +0200
From: Cyrille Lefevre <cyrille DOT lefevre-lists AT laposte DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1.3) Gecko/20070326 Thunderbird/2.0.0.0 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Mail program
References: <666107 DOT 84266 DOT qm AT web113504 DOT mail DOT gq1 DOT yahoo DOT com>
In-Reply-To: <666107.84266.qm@web113504.mail.gq1.yahoo.com>
X-me-spamlevel: not-spam
X-me-spamrating: 38.400002
X-me-spamcause: OK, (-40)(0000)gggruggvucftvghtrhhoucdtuddrvdelhedrtdeiucetggdotefuucfrrhhofhhilhgvmecuoehnohhnvgeqnecuuegrihhlohhuthemuceftddtneculhhoghhinhculddqvddtmdenlhhoghhinhculddqvddtmd
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Note-from-DJ: This may be spam

--------------080001050303000408010904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 29/06/2010 14:24, Refr Bruhl a =E9crit :
>
>
> 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 wh=
ich I'll take up with the buildlist-mailutils AT gnu DOT org

which error ?

> Anyone got any ideas on how to get email to work without a segmentation f=
ault?

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 th=
e newbie questions.

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

mailhub=3Dsmtp.<isp>
FromLineOverride=3DYES
hostname=3Dsmtp.<isp>
rewriteDomain=3D<domain>
root=3Dpostmaster
AuthUser=3D<user>
AuthPass=3D<pass>
AuthMethod=3DLOGIN

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
--=20
mailto:Cyrille DOT Lefevre-lists AT laposte DOT net

--------------080001050303000408010904
Content-Type: text/plain;
 name="mailx"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="mailx"

#!/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


--------------080001050303000408010904
Content-Type: text/plain; charset=us-ascii

--
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
--------------080001050303000408010904--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019