public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin-apps@cygwin.com
Subject: Re: cygport announce fails unable to find mailserver
Date: Sun, 25 Oct 2020 10:18:06 -0600	[thread overview]
Message-ID: <024af1fe-29a0-b9d9-deca-5e09342a9457@SystematicSw.ab.ca> (raw)
In-Reply-To: <b932d639-68db-35c9-8e70-e121a6cffad9@SystematicSw.ab.ca>

[-- 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";

      reply	other threads:[~2020-10-25 16:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 20:53 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=024af1fe-29a0-b9d9-deca-5e09342a9457@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).