From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.help Subject: Re: gnus with multiple mail accounts Date: Fri, 16 Oct 2020 12:12:35 +0530 Organization: Code Is Great Foundation Message-ID: References: <87tuuvdvky.fsf@freegnu.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4681"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: help-gnu-emacs@gnu.org To: Jeremie Juste Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 16 08:43:15 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kTJSN-00017k-69 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 08:43:15 +0200 Original-Received: from localhost ([::1]:43846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTJSM-0001b1-35 for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 16 Oct 2020 02:43:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTJRr-0001ap-O0 for help-gnu-emacs@gnu.org; Fri, 16 Oct 2020 02:42:45 -0400 Original-Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]:36831) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kTJRp-0004pZ-VQ for help-gnu-emacs@gnu.org; Fri, 16 Oct 2020 02:42:43 -0400 Original-Received: by mail-pj1-x1030.google.com with SMTP id a1so903908pjd.1 for ; Thu, 15 Oct 2020 23:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:organization:references:mail-followup-to:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=YGsBRA4ilP3idEI0wmnfD24C5b6D85kuhlle4l+WWB0=; b=sqL8umTIPLixNANWbHwR3fOclGS0byURNAuXx6+ZLSvA1s9jfqsMKL8r5tw+ScICUT 3B81kYQ/OlyDTe6qI4u3tuy7foLkSdqauGQLXFV2ELG4pPLAqKmCiFBOWrDHF7QeQvsA X42kfjf8sWshbu3Q09uHztc9qTl8sCUfSregZnDS+t5iwB/fvleU4XYn9beVRD4Z9iag OsRAgFvY1TIHjFbeDT04l8HdzFRssDZbMMcjfiHMY5YnOTKNMsIolO9LxeWi8y5cCuhF fkvS+jxIeQYEd5poUVAVYPMPbpptlXkAu2OonkDWGzmAs3yzS94GQNBpq0zI4eRVsWUd 1TWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-followup-to:date:in-reply-to:message-id:user-agent :mime-version:content-transfer-encoding; bh=YGsBRA4ilP3idEI0wmnfD24C5b6D85kuhlle4l+WWB0=; b=R8wQ23jqnc+9K2tbD1eFj2eG+T9NFjkyI86k78qBC8tCsR8MeZxREtx3w2hzW1KivP YU3wcLNpXXVBIWpdsNYAulvsoHiJ1LDMPBBLinIL9DjFeHdIGq/wcRZAuMQtro9vNmKT eYqc0W5d+4FQl2iEjRFYfH1+5uzc1E005fmYVO3ZO++Fx2GOfOoJJ3wdoxBnaEPOzBwz DzRtMBXiv2tuMRCh01wTuYY4c/Tx4NDPncjrsOlLZcWr7kirrWnwGahmxQCzSXcfiPVn B0PsQnPckg/YZWr5o8hRC5FebWPFmf+HKWcWPEG1lRoTzbTXKiE6Iee6ZVKe2o3YyZOn WhQA== X-Gm-Message-State: AOAM53133HaL6Udpgz8rXW9gb+OOlPaWp0l7c6KY+JEwlCl7/9kyfjwb iqS/8GutUmKnLPBbojyyEVNXZuVvV0lIpA== X-Google-Smtp-Source: ABdhPJxaTxiPqTogpOIpl3npLbHQu7V3VPUE1NnA15hzUYQz9nUhd6CNvyC8ZXSCu140C833rlXUuA== X-Received: by 2002:a17:90b:718:: with SMTP id s24mr2572427pjz.107.1602830559439; Thu, 15 Oct 2020 23:42:39 -0700 (PDT) Original-Received: from mb2.local ([2405:201:5c06:7897:2992:372b:c7d4:9c4f]) by smtp.gmail.com with ESMTPSA id h9sm1480780pfh.213.2020.10.15.23.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 23:42:39 -0700 (PDT) Mail-Followup-To: Jeremie Juste , help-gnu-emacs@gnu.org In-Reply-To: <87tuuvdvky.fsf@freegnu.i-did-not-set--mail-host-address--so-tickle-me> (Jeremie Juste's message of "Thu, 15 Oct 2020 23:32:13 +0200") Received-SPF: none client-ip=2607:f8b0:4864:20::1030; envelope-from=pankaj.jangid@codeisgreat.com; helo=mail-pj1-x1030.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124495 Archived-At: Jeremie Juste writes: > I would like send mail from more than one mail account from gnus. > I tried to use X-Message-SMTP-Method (info "(gnus) Posting Styles")=20 > but I don't know how to change the smtpmail-stream-type. I am using the same trick and it is working fine in my setup. i.e. setting X-Message-SMTP-Method field is enough. > > So I have come up with the following function. I only need to automate > it to do the right assignment depending on which group I'm in. Do you > have any lead please? To automate it, you may call your method in =E2=80=98message-setup-hook=E2= =80=99. It should work with =E2=80=98message-header-setup-hook=E2=80=99 as well. In my case, I am reading SMTP settings from a file where I have kept mappings like this: #+begin_src emacs-lisp ;;; -*- lisp-data -*- (("my@gmail.com" . "smtp smtp.gmail.com 587 my@gmail.com") ("my@outlook.com" . "smtp smtp.office365.com 587 my@outlook.com")) #+end_src And in my version of (set-smtp) #+begin_src emacs-lisp (defun my/set-smtp () "Set SMTP field as per FROM field." (interactive) (progn (declare-function message-add-header "message.el") (message-add-header (concat "X-Message-SMTP-Method: " (my/get-smtp))))) #+end_src (my/get-smtp) fetches the right SMTP depending upon the "From" field. But when I invoke it in =E2=80=98message-header-setup-hook=E2=80=99 = it throws error because the "from" field is not yet set. So I am calling it via =E2=80=98message-setup-hook=E2=80=99, which is triggered as the first thing= before making any changes in the body.