From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76544 Path: news.gmane.org!not-for-mail From: Philipp Haselwarter Newsgroups: gmane.emacs.gnus.general Subject: Re: smtp credential, multiple smtp, posting styles and smtpmail Date: Thu, 10 Feb 2011 12:33:24 +0100 Message-ID: <87ipws86pn.fsf@netarch.haselwarter.org> References: <87ipwsw8j9.fsf@keller.adm.naquadah.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P" X-Trace: dough.gmane.org 1297337640 16852 80.91.229.12 (10 Feb 2011 11:34:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 10 Feb 2011 11:34:00 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M24891@lists.math.uh.edu Thu Feb 10 12:33:56 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PnUmV-00031C-6T for ding-account@gmane.org; Thu, 10 Feb 2011 12:33:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PnUmO-0000WS-EI; Thu, 10 Feb 2011 05:33:44 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PnUmN-0000WF-0K for ding@lists.math.uh.edu; Thu, 10 Feb 2011 05:33:43 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PnUmL-0002dI-Lj for ding@lists.math.uh.edu; Thu, 10 Feb 2011 05:33:42 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1PnUmK-0000p0-V6 for ding@gnus.org; Thu, 10 Feb 2011 12:33:40 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PnUmK-0002sP-20 for ding@gnus.org; Thu, 10 Feb 2011 12:33:40 +0100 Original-Received: from mna75-3-89-83-43-131.dsl.club-internet.fr ([89.83.43.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Feb 2011 12:33:40 +0100 Original-Received: from philipp.haselwarter by mna75-3-89-83-43-131.dsl.club-internet.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 10 Feb 2011 12:33:40 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 102 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: mna75-3-89-83-43-131.dsl.club-internet.fr X-NSA-Fodder: offensive information warfare MIT-LL codes Chobetsu embassy X-Windows: you'd better sit down. User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:qNYK0YwPk3VyL68JnsLJGoBfVhs= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76544 Archived-At: --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P Content-Type: text/plain My config is using the code from emacswiki. I set my identities with posting styles, smtp parameters get set on sending. Works flawlessly, with no dependency on external programs. --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P Content-Type: application/emacs-lisp Content-Disposition: inline; filename=.emacs Content-Transfer-Encoding: quoted-printable (defun set-smtp (mech server port user password) "Set related SMTP variables for supplied parameters." (setq smtpmail-smtp-server server smtpmail-smtp-service port smtpmail-auth-credentials (list (list server port user password)) smtpmail-auth-supported (list mech) smtpmail-starttls-credentials nil) (message "Setting SMTP server to `%s:%s' for user `%s'." server port user)) (defun set-smtp-ssl (server port user password &optional key cert) "Set related SMTP and SSL variables for supplied parameters." (setq starttls-use-gnutls t starttls-gnutls-program "gnutls-cli" ;; TODO: Add this to the server parameters ;; starttls-extra-arguments nil smtpmail-smtp-server server smtpmail-smtp-service port smtpmail-auth-credentials (list (list server port user password)) smtpmail-starttls-credentials (list (list server port key cert))) (message "Setting SMTP server to `%s:%s' for user `%s'. (SSL enabled.)" server port user)) (defun change-smtp () "Change the SMTP server according to the current from line." (interactive) (save-excursion (loop with from =3D (save-restriction (message-narrow-to-headers) (message-fetch-field "from")) for (auth-mech address . auth-spec) in smtp-accounts when (string-match address from) do (cond ((memq auth-mech '(cram-md5 plain login)) (return (apply 'set-smtp (cons auth-mech auth-spec)))) ((eql auth-mech 'ssl) (return (apply 'set-smtp-ssl auth-spec))) (t (error "Unrecognized SMTP auth. mechanism: `%s'." auth-mec= h))) finally (error "Cannot infer SMTP information.")))) (add-hook 'message-send-hook 'change-smtp) --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P Content-Type: application/emacs-lisp Content-Disposition: inline; filename=.gnus.el Content-Transfer-Encoding: quoted-printable (setq smtp-accounts '((ssl "philipp.haselwarter@gmx.de" "localhost" "2025" "philipp" nil) (ssl "philipp.haselwarter@etu.upmc.fr" "courriel.upmc= .fr" "587" "29....." nil) (ssl "me@gmail.com" "smtp.gmail.com" "587" "me@gmail.com" nil))) (setq gnus-posting-styles '((".*" (name "Philipp Haselwarter") (address "philipp.haselwarter@gmx.de") (body "\n\n") (signature-file "~/.signature")) ("University" (name "Philipp Haselwarter") (address "philipp.haselwarter@etu.upmc.fr")))) --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P Content-Type: application/octet-stream Content-Disposition: inline; filename=.authinfo.gpg Content-Transfer-Encoding: base64 bWFjaGluZSBjb3VycmllbC51cG1jLmZyIGxvZ2luIDI5Li4uLi4gcGFzc3dvcmQgcGFzc3dvcmQx IHBvcnQgNTg3Cm1hY2hpbmUgbG9jYWxob3N0IGxvZ2luIHBoaWxpcHAgcGFzc3dvcmQgcGFzc3dv cmQyIHBvcnQgMjAyNQo= --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P Content-Type: text/plain I have a gnus startup hook that opens a ssh tunnel to my mailserver on port 443 which allows me to read/send mail from behind firewalls, thus localhost as primary smtp server. -- Philipp Haselwarter --high-security/AIMSX/credit-card/Saddam-Hussein/Pine-Gap/MONBRC8q4P--