bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24653: 25.1.50; Gnus; X-Message-SMTP-Method header does not support


From: Alain Schneble
Subject: bug#24653: 25.1.50; Gnus; X-Message-SMTP-Method header does not support port number as advertised
Date: Sun, 9 Oct 2016 21:00:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (windows-nt)

Tags: patch

Here is a patch supposed to solve this issue.

Thanks.
Alain

>From d4ab03eccee5651bd705d939d3ae93be294e0e92 Mon Sep 17 00:00:00 2001
From: Alain Schneble <a.s@realize.ch>
Date: Sun, 9 Oct 2016 20:46:58 +0200
Subject: [PATCH] Support port number in Gnus X-Message-SMTP-Method header

* lisp/gnus/message.el (message-multi-smtp-send-mail): Try to parse
service as port number.  If it succeeds, use parsed number, else use
supplied service name as before.
---
 lisp/gnus/message.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index ed0422c..19a777f 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -4807,9 +4807,11 @@ message-multi-smtp-send-mail
        (message-send-mail-with-sendmail))
        ((equal (car method) "smtp")
        (require 'smtpmail)
-       (let ((smtpmail-smtp-server (nth 1 method))
-             (smtpmail-smtp-service (nth 2 method))
-             (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user)))
+       (let* ((smtpmail-smtp-server (nth 1 method))
+              (service (nth 2 method))
+              (port (string-to-number service))
+              (smtpmail-smtp-service (if (< 0 port) port service))
+              (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user)))
          (message-smtpmail-send-it)))
        (t
        (error "Unknown method %s" method))))))
-- 
2.9.1

Alain Schneble <a.s@realize.ch> writes:

> Gnus X-Message-SMTP-Method header does not support a port number in its
> value even though this is described in the manual.  This special header
> can be used to specify an alternative email server to which the message
> should be sent.  It works properly when supplying a service name like
> smtp, but not with a service port number.
>
> Recipe:
> - emacs -Q
> - eval:
>   (defun test-message-send-hook ()
>     (message-add-header "X-Message-SMTP-Method: smtp smtp.fsf.org 587"))
>   (add-hook 'message-send-hook 'test-message-send-hook)
> - M-x compose-mail
> - Fill in To and Subject headers
> - M-x message-send-and-exit
>
>   It terminates with an error:
>   => Unknown service: 587
>
> This scenario should be supported as described in the manual:
>
> - (info "(message)Mail Variables")
>   See description of ‘message-send-mail-function’ about ‘smtpmail’:
>   
>        ‘smtpmail’
>
>                X-Message-SMTP-Method: smtp smtp.fsf.org 587
>
>           This will send the message via ‘smtp.fsf.org’, using port 587.
>
>                X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
>
>           This is the same as the above, but uses ‘other-user’ as the
>           user name when authenticating.  This is handy if you have
>           several SMTP accounts on the same server.
>
> Alain
>
>
> In GNU Emacs 25.1.50.1 (x86_64-w64-mingw32)
>  of 2016-09-27 built on MYNGB
> Repository revision: bbf1ffd7c74bdf3ea766580788f7f4adb98a47f0
> Windowing system distributor 'Microsoft Corp.', version 10.0.10586
> Configured using:
>  'configure --prefix /c/usr/bin/emacs-25.1 --without-imagemagick'
>
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
> TOOLKIT_SCROLL_BARS
>
> Important settings:
>   value of $LANG: DES
>   locale-coding-system: cp1252
>
> Major mode: Org
>
> Minor modes in effect:
>   org-indent-mode: t
>   global-git-commit-mode: t
>   async-bytecomp-package-mode: t
>   shell-dirtrack-mode: t
>   diff-auto-refine-mode: t
>   gdb-many-windows: t
>   winner-mode: t
>   icomplete-mode: t
>   show-paren-mode: t
>   display-time-mode: t
>   display-battery-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent messages:
> kmacro-call-macro: No kbd macro has been defined
> C-x C-g is undefined
> Quit
> Type "q" in help window to restore its previous buffer. [2 times]
> Auto-saving...done
> Saving file c:/data/private/git/Emacs.org...
> Wrote c:/data/private/git/Emacs.org
> Mark set
> Auto-saving...done
> Auto-saving...done
>
> Features:
> (shadow sort mail-extr emacsbug debug apropos org-indent org-element
> org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view subr-x
> jka-compr image-mode org-bibtex bibtex org-bbdb org-w3m bongo
> lastfm-submit smtpmail sendmail thingatpt eieio-opt speedbar sb-image
> ezimage dframe ace-window ace-jump-mode cl ssh-agency magit-blame
> magit-stash magit-bisect magit-remote magit-commit magit-sequence magit
> magit-apply magit-wip magit-log magit-diff smerge-mode magit-core
> magit-process magit-popup magit-mode magit-git crm magit-section
> magit-utils git-commit log-edit message rfc822 mml mml-sec epg mm-decode
> mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums
> mailabbrev gmm-utils mailheader pcvs-util add-log with-editor
> async-bytecomp async tramp-sh tramp tramp-compat auth-source
> password-cache tramp-loaddefs trampver ucs-normalize shell advice dash
> misearch multi-isearch dired-aux dired vc-git diff-mode cc-mode cc-fonts
> cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
> cl-seq gdb-mi bindat json map gud linum paredit winner ob-ditaa
> ob-gnuplot org org-macro org-footnote org-pcomplete pcomplete org-list
> org-faces org-entities noutline outline easy-mmode org-version
> ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys
> ob-comint comint ansi-color ring ob-core ob-eval org-compat org-macs
> org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs
> warnings server ido icomplete sanityinc-tomorrow-night-theme
> sanityinc-tomorrow-bright-theme color-theme-sanityinc-tomorrow paren
> gnus gnus-ems nnheader gnus-util mail-utils mm-util help-fns mail-prsvr
> wid-edit time battery cus-start cus-load finder-inf ac-js2-autoloads
> ace-window-autoloads ace-jump-mode-autoloads bongo-autoloads
> color-theme-sanityinc-tomorrow-autoloads company-autoloads
> emms-autoloads expand-region-autoloads gnuplot-autoloads
> gnuplot-mode-autoloads google-this-autoloads js2-refactor-autoloads
> json-mode-autoloads json-reformat-autoloads json-snatcher-autoloads
> eieio eieio-core cl-macs multiple-cursors-autoloads
> auto-complete-autoloads flycheck-autoloads paredit-autoloads
> pkg-info-autoloads epl-autoloads popup-autoloads s-autoloads
> skewer-mode-autoloads js2-mode-autoloads simple-httpd-autoloads
> solarized-theme-autoloads spacegray-theme-autoloads swift-mode-autoloads
> info yasnippet-autoloads zenburn-theme-autoloads package epg-config seq
> byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv
> edmacro kmacro cl-loaddefs pcase cl-lib time-date mule-util tooltip
> eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
> dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win tool-bar dnd
> fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
> lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
> scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
> cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
> tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
> slovak czech european ethiopic indian cyrillic chinese charscript
> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
> cl-preloaded nadvice loaddefs button faces cus-face macroexp files
> text-properties overlay sha1 md5 base64 format env code-pages mule
> custom widget hashtable-print-readable backquote w32notify w32 multi-tty
> make-network-process emacs)
>
> Memory information:
> ((conses 16 579416 81602)
>  (symbols 56 45654 0)
>  (miscs 48 1666 705)
>  (strings 32 114550 13852)
>  (string-bytes 1 3347364)
>  (vectors 16 67967)
>  (vector-slots 8 1750918 177142)
>  (floats 8 434 233)
>  (intervals 56 14576 548)
>  (buffers 976 175))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]