cygport announce fails unable to find mailserver
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Sat Oct 24 23:19:11 GMT 2020
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.]
-------------- next part --------------
--- 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');
More information about the Cygwin-apps
mailing list