From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arash Esbati Newsgroups: gmane.emacs.help Subject: Re: How to dynamically select msmtp profile when sending a message? Date: Thu, 13 Jun 2024 19:24:31 +0200 Message-ID: References: <3d6fbb70-3ec7-45cb-958b-1dffce16cca0@app.fastmail.com> <00aa97e5-f947-45bd-bee7-64716dbaa4d6@app.fastmail.com> <871q506apa.fsf@gilgamesh.mail-host-address-is-not-set> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35047"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: "emacs-help" To: Adham Omran Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 13 19:25:38 2024 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 1sHoCg-0008s6-Bz for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 13 Jun 2024 19:25:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHoC3-0008R6-QX; Thu, 13 Jun 2024 13:24:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHoC1-0008Qc-LJ for help-gnu-emacs@gnu.org; Thu, 13 Jun 2024 13:24:57 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHoBx-00067p-OT; Thu, 13 Jun 2024 13:24:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=GfncjTknbMLx91sAMAdIOANVao6IQ2CbdHCK8rVwTFQ=; b=K0QAfJj7JK6Jert1YzAN 0QLht+xhkdRmqvlJUAlkIq2PZ0br233tt6tU8MfPKFB318UdNgisi29bDO+6sUZv2ndWj04vhSSV1 2Z2rqVf/1tWO69YUJYCtxkIJZHSBihGwrU6XJpvs5dYHEL1/c8C3PGI1MJ9CP9xLTmuDIujLLlsn+ afuKJVoy6B3CQL0OKWRK7Xi7w4pSzAxELx+Bt1Cd6YBFME0y82N5YZbMvDELNIanWz+R7LL0CLI8v AuRzTjfRGHtrsZlqwr9TPTfGEDFmtewGpuLKFePCYOsLXkGqNrg2WPEYZMlLbSf8CRaPzt561Otb0 7qErSjf1Pkv5mQ==; In-Reply-To: <871q506apa.fsf@gilgamesh.mail-host-address-is-not-set> (Adham Omran's message of "Thu, 13 Jun 2024 19:58:57 +0300") X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146891 Archived-At: Adham Omran writes: > This configuration set made it work for me! > > I do not know what the issue was but I suspect it was not reading from > the headers properly, thank you very much. You're welcome. This is from msmtp manual[1]: 3.3 Choosing an account There are three ways to choose the account to use. 1. --account=account Use the given account. Command line settings override configuration file settings. 2. --host=hostname Use only the settings from the command line; do not use any configuration file data. 3. --from=address or --read-envelope-from Choose the first account from the system or user configuration file that has a matching envelope-from address as specified by a from command. This works only when neither --account nor --host is used. Subadresses are supported. For example, the envelope from address user+detail@example.com will match the account for user@example.com. Furthermore, the envelope-from address of the account may be a wildcard pattern. See from. If none of the above options is used (or if no account has a matching from command), then the account "default" is used. The tricky part is to tell msmtp about item 3. which is done by setting the variables in my message upthread. Best, Arash Footnotes: [1] https://marlam.de/msmtp/msmtp.html#Choosing-an-account-1