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: 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 +# Copyright (C) 2014-2020 Cygport authors +# Provided by the Cygwin project # # 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: +Reply-To: 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";