public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* cygport announce fails unable to find mailserver
@ 2020-10-24 20:53 Brian Inglis
  2020-10-24 21:42 ` Ken Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2020-10-24 20:53 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]

Hi folks,

Do any/some/many of you use cygport ...cygport announce to generate your update
announcements, and does it work successfully?

It has never worked for me, but Thunderbird, git send-email, mailx, mail, email,
s-nail, my own scripts, with similar configs, and telnet, work okay, as shown at
the bottom of this email and the log.

Any ideas why cygport ... announce using perl libnet/Net::SMTP would have
problems, how to diagnose or debug, and fix?

Relevant code follows +/_pkg_announce /usr/share/cygport/lib/pkg_upload.cygpart

Attached log has irrelevant output and escape sequences removed, commands added,
and remainder sanitized; summary is:

$ cygport --debug tzcode.cygport announce |& tee cygport-announce-no-mailserver.log
...
>>> Preparing announcement tzcode-2020d-1.x86_64
+ __pkg_announce
...
+ /usr/bin/vim /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
Vim: Warning: Output is not to a terminal
ZZ
+ perl /dev/fd/62
++ cat
Sending announcement of tzcode-2020d-1 via smtp
No mailserver at smtp at /dev/fd/62 line 16.
+ error 'Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
+ case $? in
+ local errorcode=9
+ echo -e '*** ERROR: Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
*** ERROR: Sending announcement failed, mbox is
/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
+ exit 9
$ telnet smtp smtp |& tee -a cygport-announce-no-mailserver.log
Trying ...
Connected to smtp.
Escape character is '^]'.
220 mo22.dcs.int.inet ...ca ESMTP server ready
250-mo22.dcs.int.inet hello [...], pleased to meet you
250-HELP
250-SIZE 29360128
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
221 2.0.0 mo22.dcs.int.inet ...ca closing connection
Connection closed by foreign host.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

[-- Attachment #2: cygport-announce-no-mailserver.log --]
[-- Type: text/plain, Size: 2933 bytes --]

$ cygport --debug tzcode.cygport announce |& tee cygport-announce-no-mailserver.log
...
+ for conf in "${HOME}/.config/cygport.conf" "${HOME}/.cygport/cygport.conf" "${HOME}/.cygport.conf" "${HOME}/.cygportrc" "${_privsysconfdir}/cygport.conf"
+ '[' -e /home/bwi/.cygport.conf ']'
+ source /home/bwi/.cygport.conf
++ DISTDIR=/var/cache/setup/local
++ SSH_KEY=/home/bwi/.ssh/...
++ SMTP_SENDER='Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>'
++ SMTP_SERVER=smtp
...
+ case ${argv[${arg_n}]} in
+ __stage 'Preparing announcement'
+ echo -e '\e[1;39m>>> Preparing announcement tzcode-2020d-1.x86_64\e[0;0m'
>>> Preparing announcement tzcode-2020d-1.x86_64
+ __pkg_announce
++ mktemp -t cygwin-announce-tzcode-2020d-1.XXXXXX
+ local msg=/tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
++ date +@%s
+ local msgat=@1603569647
+ local -i n=0
+ cat
++ date '+%a %b %d %H:%M:%S %Y' --date=@1603569647
++ date -R --date=@1603569647
++ date +%Y%m%d%H%M%S.3202 --date=@1603569647
++ echo Brian Inglis '<Brian.Inglis@SystematicSW.ab.ca>'
++ sed 's|.*<\(.*\)>.*|\1|'
+ ((  n < pkg_count  ))
+ echo '* tzcode-2020d-1'
+ let n+=1
+ ((  n < pkg_count  ))
+ cat
+ /usr/bin/vim /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
Vim: Warning: Output is not to a terminal
From cygwin-announce-tzcode-2020d-1 Sat Oct 24 14:00:47 2020
From: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
To: cygwin-announce@cygwin.com
Date: Sat, 24 Oct 2020 14:00:47 -0600
Message-Id: <20201024140047.3202-1-Brian.Inglis@SystematicSW.ab.ca>
Subject: tzcode 2020d-1

The following packages have been uploaded to the Cygwin distribution:

* tzcode-2020d-1

The Time Zone Database (often called tz, tzdb, or zoneinfo) contains
data that represents the history of local time for many locations around
the world, and supports conversion of UTC time to local time at those
locations to allow display of those local times. It is updated
periodically to reflect changes made by political bodies to daylight
saving (summer time) rules, UTC offsets, and time zone boundaries.
This package provides the tzselect, zic, zdump utilities.
ZZ
+ perl /dev/fd/62
++ cat
Sending announcement of tzcode-2020d-1 via smtp
No mailserver at smtp at /dev/fd/62 line 16.
+ error 'Sending announcement failed, mbox is /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
+ case $? in
+ local errorcode=9
+ echo -e '*** ERROR: Sending announcement failed, mbox is /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN'
*** ERROR: Sending announcement failed, mbox is /tmp/cygwin-announce-tzcode-2020d-1.oKxmkN
+ exit 9
$ telnet smtp smtp |& tee -a cygport-announce-no-mailserver.log
Trying ...
Connected to smtp.
Escape character is '^]'.
220 mo22.dcs.int.inet ...ca ESMTP server ready
250-mo22.dcs.int.inet hello [...], pleased to meet you
250-HELP
250-SIZE 29360128
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
221 2.0.0 mo22.dcs.int.inet ...ca closing connection
Connection closed by foreign host.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-24 20:53 cygport announce fails unable to find mailserver Brian Inglis
@ 2020-10-24 21:42 ` Ken Brown
  2020-10-24 22:21   ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Brown @ 2020-10-24 21:42 UTC (permalink / raw)
  To: cygwin-apps

On 10/24/2020 4:53 PM, Brian Inglis wrote:
> Hi folks,
> 
> Do any/some/many of you use cygport ...cygport announce to generate your update
> announcements, and does it work successfully?

I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If 
you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and 
edit it.

Ken

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-24 21:42 ` Ken Brown
@ 2020-10-24 22:21   ` Brian Inglis
  2020-10-24 23:19     ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2020-10-24 22:21 UTC (permalink / raw)
  To: cygwin-apps

On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>> Hi folks,
>>
>> Do any/some/many of you use cygport ...cygport announce to generate your update
>> announcements, and does it work successfully?
> 
> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
> edit it.

Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
Nothing else is required (yet)!

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-24 22:21   ` Brian Inglis
@ 2020-10-24 23:19     ` Brian Inglis
  2020-10-24 23:50       ` Jon Turney
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2020-10-24 23:19 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 4367 bytes --]

On 2020-10-24 16:21, Brian Inglis wrote:
> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>> Do any/some/many of you use cygport ...cygport announce to generate your update
>>> announcements, and does it work successfully?
>>
>> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>> edit it.
> 
> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
> Nothing else is required (yet)!

Hacked out the perl code into a file and got it running and failing.
Added Net:SMTP() Debug parameter and set it.
Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
maildomain!

So added parameter with other value and it worked.

See Failure and Success logs below.

With a bit more work, we can get the default local host network domain name (ISP
or org), and update that from the sender email address if available.

+use Net::Domain qw(hostdomain);
+my $hello = hostdomain();
+$hello = $1 if ($entity->head->get('From') =~ m/<?[^@>]+@([^>]+)>?/);
+my $smtp = new Net::SMTP($smtp_server,
			  Port => 25,
+			  Hello => $hello,
#			  Debug => 1,
			  SSL => $smtp_encryption eq 'ssl')
+	or die "No mailserver at ".$smtp_server.":".$@;

A functional patch is attached, but someone who really knows what they're doing
with SMTP, Perl, embedding the latter in shell scripts, and getting them to work
needs to apply something like this, make it a conditional setting based on
another cygport config flag e.g. SMTP_HELLO=1, or some enumeration.

It should also be possible to handle the STARTTLS response and switch the
connection to be encrypted, but that is way over my head in Perl.

Failure log:

$ src/cygwin/cygport-pkg-announce-email.pl
Sending announcement of tzcode 2020d via smtp
Net::SMTP>>> Net::SMTP(3.11)
Net::SMTP>>>   Net::Cmd(3.11)
Net::SMTP>>>     Exporter(5.73)
Net::SMTP>>>   IO::Socket::IP(0.39)
Net::SMTP>>>     IO::Socket(1.40)
Net::SMTP>>>       IO::Handle(1.40)
Net::SMTP=GLOB(0x80112a000)<<< 220 mo22.dcs.int.inet ...ca ESMTP server ready
Net::SMTP=GLOB(0x80112a000)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x80112a000)<<< 501 EHLO invalid ehlo (localhost.localdomain)
Net::SMTP=GLOB(0x80112a000)>>> HELO localhost.localdomain
Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at
src/cygwin/cygport-pkg-announce-email.pl line 27.
No mailserver at smtp:Net::SMTP: 421 [Net::SMTP] Connection closed at
src/cygwin/cygport-pkg-announce-email.pl line 27.

[SMTP 421 means Try again later]

Success log:

$ src/cygwin/cygport-pkg-announce-email.pl
Sending announcement of tzcode 2020d via smtp
Net::SMTP>>> Net::SMTP(3.11)
Net::SMTP>>>   Net::Cmd(3.11)
Net::SMTP>>>     Exporter(5.73)
Net::SMTP>>>   IO::Socket::IP(0.39)
Net::SMTP>>>     IO::Socket(1.40)
Net::SMTP>>>       IO::Handle(1.40)
Net::SMTP=GLOB(0x80110cf10)<<< 220 mo24.dcs.int.inet ...ca ESMTP server ready
Net::SMTP=GLOB(0x80110cf10)>>> EHLO SystematicSW.ab.ca
Net::SMTP=GLOB(0x80110cf10)<<< 250-mo24.dcs.int.inet hello [...], pleased to
meet you
Net::SMTP=GLOB(0x80110cf10)<<< 250-HELP
Net::SMTP=GLOB(0x80110cf10)<<< 250-SIZE 29360128
Net::SMTP=GLOB(0x80110cf10)<<< 250-ENHANCEDSTATUSCODES
Net::SMTP=GLOB(0x80110cf10)<<< 250-8BITMIME
Net::SMTP=GLOB(0x80110cf10)<<< 250-STARTTLS
Net::SMTP=GLOB(0x80110cf10)<<< 250 OK
Net::SMTP=GLOB(0x80110cf10)>>> MAIL FROM:<Brian.Inglis@SystematicSW.ab.ca>
Net::SMTP=GLOB(0x80110cf10)<<< 250 2.1.0 <brian.inglis@systematicsw.ab.ca> sender ok
Net::SMTP=GLOB(0x80110cf10)>>> RCPT TO:<cygwin-announce@cygwin.com>
Net::SMTP=GLOB(0x80110cf10)<<< 250 2.1.5 <cygwin-announce@cygwin.com> recipient ok
Net::SMTP=GLOB(0x80110cf10)>>> DATA
...
Net::SMTP=GLOB(0x80110cf10)>>> .
NNet::SMTP=GLOB(0x80110cf10)<<< 250 2.0.0 WSGzktx91RAWfWSH1kHFQt mail accepted
for delivery
Net::SMTP=GLOB(0x80110cf10)>>> QUIT
Net::SMTP=GLOB(0x80110cf10)<<< 221 2.0.0 mo24.dcs.int.inet ...ca closing connection
Announcement sent

-- 
-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

[-- Attachment #2: cygport-lib-pkg_upload.patch --]
[-- Type: text/plain, Size: 1673 bytes --]

--- a/pkg_upload.cygpart	2019-03-04 19:28:36.593859100 -0700
+++ b/pkg_upload.cygpart	2020-10-24 17:11:34.699008700 -0600
@@ -2,8 +2,8 @@
 #
 # pkg_upload.cygpart - cygport package uploading functions
 #
-# Copyright (C) 2014-2019 Yaakov Selkowitz, Andrew Schulman
-# Provided by the Cygwin Ports project <http://sourceware.org/cygwinports/>
+# Copyright (C) 2014-2020 Cygport authors
+# Provided by the Cygwin project <https://cygwin.com/>
 #
 # cygport is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ __pkg_upload() {
 
 	# Check that binary and source package files exist
 
-	pkg_files=("${NAME}/${NAME}-${PVR}-src.tar.xz" "${NAME}/${NAME}-${PVR}.hint")
+	pkg_files=("${NAME}/${NAME}-${PVR}-src.tar.xz" "${NAME}/${NAME}-${PVR}-src.hint")
 
 	while (( n < pkg_count ))
 	do
@@ -202,6 +202,7 @@ _EOF
 use strict;
 use MIME::Parser;
 use Net::SMTP;
+use Net::Domain qw(hostdomain);
 
 my \$smtp_server = "${SMTP_SERVER:-localhost}";
 my \$smtp_encryption = "${SMTP_ENCRYPTION:-none}";
@@ -214,10 +215,13 @@ my \$entity = \$parser->parse_open("$msg
 
 print "Sending announcement of ${NAME}-${PVR} via \$smtp_server\n";
 
+my \$hello = hostdomain();
+\$hello = \$1 if (\$entity->head->get('From') =~ m/<?[^@>]+@([^>]+)>?/);
 my \$smtp = new Net::SMTP(\$smtp_server,
 			  ${SMTP_SERVER_PORT+Port => ${SMTP_SERVER_PORT},}
+			  Hello => \$hello,
 			  SSL => \$smtp_encryption eq 'ssl')
-	 or die "No mailserver at ".\$smtp_server;
+	 or die "No mailserver at ".\$smtp_server.":".\$@;
 if (\$smtp_encryption eq 'tls') {
 	require Net::SMTP::SSL;
 	\$smtp->command('STARTTLS');

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-24 23:19     ` Brian Inglis
@ 2020-10-24 23:50       ` Jon Turney
  2020-10-25  4:37         ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Turney @ 2020-10-24 23:50 UTC (permalink / raw)
  To: cygwin-apps

On 25/10/2020 00:19, Brian Inglis wrote:
> On 2020-10-24 16:21, Brian Inglis wrote:
>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>> Do any/some/many of you use cygport ...cygport announce to generate your update
>>>> announcements, and does it work successfully?
>>>
>>> I use it.  You have to set several SMTP_* variables in your ~/.cygport.conf.  If
>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>> edit it.
>>
>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>> Nothing else is required (yet)!
> 
> Hacked out the perl code into a file and got it running and failing.
> Added Net:SMTP() Debug parameter and set it.
> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
> maildomain!

Whatever you are doing it spamming cygwin-announce with messages which 
are (fortunately) being held due to 'Message has implicit destination'.

I rejected all the held mails, but please stop.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-24 23:50       ` Jon Turney
@ 2020-10-25  4:37         ` Brian Inglis
  2020-10-25 16:18           ` Brian Inglis
  0 siblings, 1 reply; 7+ messages in thread
From: Brian Inglis @ 2020-10-25  4:37 UTC (permalink / raw)
  To: cygwin-apps

On 2020-10-24 17:50, Jon Turney wrote:
> On 25/10/2020 00:19, Brian Inglis wrote:
>> On 2020-10-24 16:21, Brian Inglis wrote:
>>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>>> Do any/some/many of you use cygport ...cygport announce to generate your
>>>>> update
>>>>> announcements, and does it work successfully?
>>>>
>>>> I use it.  You have to set several SMTP_* variables in your
>>>> ~/.cygport.conf.  If
>>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>>> edit it.
>>>
>>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>>> Nothing else is required (yet)!
>>
>> Hacked out the perl code into a file and got it running and failing.
>> Added Net:SMTP() Debug parameter and set it.
>> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
>> maildomain!
> 
> Whatever you are doing it spamming cygwin-announce with messages which are
> (fortunately) being held due to 'Message has implicit destination'.
> 
> I rejected all the held mails, but please stop.

Sorry about that; trying to diagnose, debug, and fix failures and content issues
with cygport ... announce; hacking without any real background knowledge of
SMTP, Perl, or cygport; still trying to track down issues with generated message
content: sorry about those that made it thru; I'll do my best to ensure future
tests are directed elsewhere.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cygport announce fails unable to find mailserver
  2020-10-25  4:37         ` Brian Inglis
@ 2020-10-25 16:18           ` Brian Inglis
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Inglis @ 2020-10-25 16:18 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 2443 bytes --]

On 2020-10-24 22:37, Brian Inglis wrote:
> On 2020-10-24 17:50, Jon Turney wrote:
>> On 25/10/2020 00:19, Brian Inglis wrote:
>>> On 2020-10-24 16:21, Brian Inglis wrote:
>>>> On 2020-10-24 15:42, Ken Brown via Cygwin-apps wrote:
>>>>> On 10/24/2020 4:53 PM, Brian Inglis wrote:
>>>>>> Do any/some/many of you use cygport ...cygport announce to generate your
>>>>>> update
>>>>>> announcements, and does it work successfully?
>>>>>
>>>>> I use it.  You have to set several SMTP_* variables in your
>>>>> ~/.cygport.conf.  If
>>>>> you don't already have that file, copy /etc/cygport.conf to ~/.cygport.conf and
>>>>> edit it.
>>>>
>>>> Thanks, already set up with SMTP_SERVER=smtp which is all I need from my home
>>>> ISP connection for all SMTP clients (POP3, web, mobile needs user and password).
>>>> Nothing else is required (yet)!
>>>
>>> Hacked out the perl code into a file and got it running and failing.
>>> Added Net:SMTP() Debug parameter and set it.
>>> Problem is ISP SMTP MX will not accept localhost.localdomain as EHLO/HELO
>>> maildomain!
>>
>> Whatever you are doing it spamming cygwin-announce with messages which are
>> (fortunately) being held due to 'Message has implicit destination'.
>>
>> I rejected all the held mails, but please stop.
> 
> Sorry about that; trying to diagnose, debug, and fix failures and content issues
> with cygport ... announce; hacking without any real background knowledge of
> SMTP, Perl, or cygport; still trying to track down issues with generated message
> content: sorry about those that made it thru; I'll do my best to ensure future
> tests are directed elsewhere.

After hours of testing, nailed down cygport ... announce SMTP issues.

ISP requires non-default Net::SMTP Hello parameter - localhost.localdomain is
rejected - and does not allow or recognize first initial header "From " line!

So we need to drop the first initial header "From " line, and pass the Hello
parameter with a non-default mail domain value.
Suitable mail domain values available are provided by the Net::Domain
hostdomain, hostfqdn, domainname functions, or the From address domain:
the attached patch uses the first and overrides with the last if available.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


[-- Attachment #2: cygport-lib-pkg_upload.patch --]
[-- Type: text/plain, Size: 3363 bytes --]

cygport-lib-pkg_upload.cygpart(__pkg_announce): use non-default Hello string

update copyright year
(__pkg_upload): source package includes -src.hint
(__pkg_announce): drop first From header as it gets treated as data;
quote addresses in <>; add Reply-To: <cygwin@\...> header;
override Net:SMTP default Hello string localhost.localdomain with 
ISP/org host domain; could optionally be FQDN or just domain name;
override with From: address domain if available;
add Net::SMTP Hello parameter and value;
add extra failure diagnostic output;
add Cc and Bcc recipients if headers added

--- a/pkg_upload.cygpart	2019-03-04 19:28:36.593859100 -0700
+++ b/pkg_upload.cygpart	2020-10-25 01:13:35.236753400 -0600
@@ -2,8 +2,8 @@
 #
 # pkg_upload.cygpart - cygport package uploading functions
 #
-# Copyright (C) 2014-2019 Yaakov Selkowitz, Andrew Schulman
-# Provided by the Cygwin Ports project <http://sourceware.org/cygwinports/>
+# Copyright (C) 2014-2020 Cygport authors
+# Provided by the Cygwin project <https://cygwin.com/>
 #
 # cygport is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ __pkg_upload() {
 
 	# Check that binary and source package files exist
 
-	pkg_files=("${NAME}/${NAME}-${PVR}-src.tar.xz" "${NAME}/${NAME}-${PVR}.hint")
+	pkg_files=("${NAME}/${NAME}-${PVR}-src.tar.xz" "${NAME}/${NAME}-${PVR}-src.hint")
 
 	while (( n < pkg_count ))
 	do
@@ -173,10 +173,11 @@ __pkg_announce() {
 	local msgat=$(date +@%s)
 	local -i n=0
 
+#From cygwin-announce-${PF} $(date '+%a %b %d %H:%M:%S %Y' --date=${msgat})
 	cat > ${msg} <<_EOF
-From cygwin-announce-${PF} $(date '+%a %b %d %H:%M:%S %Y' --date=${msgat})
 From: ${SMTP_SENDER}
-To: cygwin-announce@cygwin.com
+To: <cygwin-announce@cygwin.com>
+Reply-To: <cygwin@cygwin.com>
 Date: $(date -R --date=${msgat})
 Message-Id: <$(date "+%Y%m%d%H%M%S.$$" --date=${msgat})-1-$(echo ${SMTP_SENDER} | sed 's|.*<\(.*\)>.*|\1|')>
 Subject: ${NAME} ${PVR}
@@ -202,6 +203,7 @@ _EOF
 use strict;
 use MIME::Parser;
 use Net::SMTP;
+use Net::Domain qw(hostdomain hostfqdn domainname);
 
 my \$smtp_server = "${SMTP_SERVER:-localhost}";
 my \$smtp_encryption = "${SMTP_ENCRYPTION:-none}";
@@ -214,10 +216,13 @@ my \$entity = \$parser->parse_open("$msg
 
 print "Sending announcement of ${NAME}-${PVR} via \$smtp_server\n";
 
+my \$hello = hostdomain(); # hostfqdn(); domainname();
+\$hello = \$1 if (\$entity->head->get('From') =~ m/<?[^@>]+@([^>]+)>?/);
 my \$smtp = new Net::SMTP(\$smtp_server,
 			  ${SMTP_SERVER_PORT+Port => ${SMTP_SERVER_PORT},}
+			  Hello => \$hello,
 			  SSL => \$smtp_encryption eq 'ssl')
-	 or die "No mailserver at ".\$smtp_server;
+	 or die "No mailserver at ".\$smtp_server.":".\$@;
 if (\$smtp_encryption eq 'tls') {
 	require Net::SMTP::SSL;
 	\$smtp->command('STARTTLS');
@@ -233,6 +238,8 @@ if (defined \$smtp_user) {
 }
 \$smtp->mail(\$entity->head->get('From')) or die "unable to set sender";
 \$smtp->to(\$entity->head->get('To')) or die "unable to address message";
+\$smtp->cc(\$entity->head->get('Cc')) if \$entity->head->get('Cc');
+\$smtp->bcc(\$entity->head->get('Bcc')) if \$entity->head->get('Bcc');
 \$smtp->data() or die "unable to start data send";
 \$smtp->datasend(\$entity->as_string()) or die "Message send failed";
 \$smtp->dataend() or die "Message end failed";

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-25 16:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24 20:53 cygport announce fails unable to find mailserver Brian Inglis
2020-10-24 21:42 ` Ken Brown
2020-10-24 22:21   ` Brian Inglis
2020-10-24 23:19     ` Brian Inglis
2020-10-24 23:50       ` Jon Turney
2020-10-25  4:37         ` Brian Inglis
2020-10-25 16:18           ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).