all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Multiple "outgoing" email accounts.
@ 2014-02-06 20:30 E Sabof
  2014-02-06 20:47 ` Herbert J. Skuhra
  2014-02-07  0:34 ` E Sabof
  0 siblings, 2 replies; 9+ messages in thread
From: E Sabof @ 2014-02-06 20:30 UTC (permalink / raw)
  To: emacs

I want to use different email accounts for sending email. I've attempted to do this by changing the following variables before starting to compose the message.

    user-full-name
    user-mail-address
    mu4e-sent-folder
    mu4e-drafts-folder
    smtpmail-default-smtp-server
    smtpmail-smtp-server
    smtpmail-stream-type
    smtpmail-smtp-service

However, once the first email is sent, all subsequent emails are sent from the same account, even though the "From:" field in the mu4e-compose-mode shows the correct email.

This is the list of variables/values that might be also relevant:

    ;;; * starttls

    (setq starttls-gnutls-program "gnutls-cli")
    (setq starttls-extra-arguments nil)
    (setq starttls-use-gnutls t)

    ;;; * smtpmail

    (setq smtpmail-stream-type 'starttls
          smtpmail-default-smtp-server "smtp.gmail.com"
          smtpmail-smtp-server "smtp.gmail.com"
          smtpmail-smtp-service 587
          )

    ;;; * sendmail

    (setq sendmail-program "/usr/bin/msmtp")
    (setq send-mail-function 'smtpmail-send-it)

    ;;; * message

    (setq message-kill-buffer-on-exit t)
    (setq message-send-mail-function 'smtpmail-send-it)

My emacs-version is below. I don't believe this to be a mu4e specific issue, since I get the same results if I switch to message-mode.

    GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4) of 2014-02-05 on ubuntu

Evgeni



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-06 20:30 Multiple "outgoing" email accounts E Sabof
@ 2014-02-06 20:47 ` Herbert J. Skuhra
  2014-02-06 22:02   ` E Sabof
  2014-02-07  0:34 ` E Sabof
  1 sibling, 1 reply; 9+ messages in thread
From: Herbert J. Skuhra @ 2014-02-06 20:47 UTC (permalink / raw)
  To: E Sabof; +Cc: emacs

On Thu, 06 Feb 2014 20:30:51 +0000
E Sabof wrote:

> I want to use different email accounts for sending email. I've
> attempted to do this by changing the following variables before
> starting to compose the message.

http://www.djcbsoftware.nl/code/mu/mu4e/Multiple-accounts.html

There is also a mu mailinglist/google group:

https://groups.google.com/forum/#!forum/mu-discuss

-- 
Herbert



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-06 20:47 ` Herbert J. Skuhra
@ 2014-02-06 22:02   ` E Sabof
  2014-02-07 17:42     ` William G Gardella
       [not found]     ` <mailman.14081.1391794971.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: E Sabof @ 2014-02-06 22:02 UTC (permalink / raw)
  To: Herbert J. Skuhra; +Cc: emacs

Herbert J. Skuhra <hskuhra@eumx.net> writes:

> http://www.djcbsoftware.nl/code/mu/mu4e/Multiple-accounts.html[1]
>
> There is also a mu mailinglist/google group:
>
> https://groups.google.com/forum/#!forum/mu-discuss[2]

The recipe I've used if from the first link. As I've written towards the end, I had the same results with the built-in message-mode, so I don't believe the issue to be mu4e-specific.

Evgeni



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-06 20:30 Multiple "outgoing" email accounts E Sabof
  2014-02-06 20:47 ` Herbert J. Skuhra
@ 2014-02-07  0:34 ` E Sabof
  1 sibling, 0 replies; 9+ messages in thread
From: E Sabof @ 2014-02-07  0:34 UTC (permalink / raw)
  To: emacs

The confusion arose because my accounts had the same smtpmail-smtp-server. Additionally specifying smtpmail-smtp-user solved the problem.

Evgeni



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-06 22:02   ` E Sabof
@ 2014-02-07 17:42     ` William G Gardella
       [not found]     ` <mailman.14081.1391794971.10748.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 9+ messages in thread
From: William G Gardella @ 2014-02-07 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

E Sabof <esabof@gmail.com> writes:
>
> The recipe I've used if from the first link. As I've written towards
> the end, I had the same results with the built-in message-mode, so I
> don't believe the issue to be mu4e-specific.
>
> Evgeni

N.B. that in emacs24, you can also specify which SMTP server to use for
message-mode on a per message basis with an "X-Message-SMTP-Method:"
header, e.g.

X-Message-SMTP-Method: smtp smtp.foo.org 465

This eliminates much of the need for the setting of individual
smtpmail-* variables in these multiple accounts configurations for
message-mode MUAs like mu4e and Gnus.  This technique also lets you
switch between use of smtpmail and use of your system's local sendmail
binary:

X-Message-SMTP-Method: sendmail

See (info "(message) Mail Variables") for more info.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
       [not found]     ` <mailman.14081.1391794971.10748.help-gnu-emacs@gnu.org>
@ 2014-02-08  4:22       ` N. Jackson
  2014-02-08  6:14         ` Eric Abrahamsen
       [not found]         ` <mailman.14149.1391839983.10748.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 9+ messages in thread
From: N. Jackson @ 2014-02-08  4:22 UTC (permalink / raw)
  To: help-gnu-emacs


"William G Gardella" <wgg2@member.fsf.org> writes:
> N.B. that in emacs24, you can also specify which SMTP server to use
> for message-mode on a per message basis with an
> "X-Message-SMTP-Method:" header, e.g.
>
> X-Message-SMTP-Method: smtp smtp.foo.org 465
>
> This eliminates much of the need for the setting of individual
> smtpmail-* variables in these multiple accounts configurations for
> message-mode MUAs like mu4e and Gnus.  This technique also lets you
> switch between use of smtpmail and use of your system's local sendmail
> binary:
>
> X-Message-SMTP-Method: sendmail
>
> See (info "(message) Mail Variables") for more info.

I've been looking at using this header for in my set up for multiple
email accounts and I find myself with questions that I haven't found the
answers to yet in the documentation:

!. Does the header get removed before the mail is sent?

2. Can one omit the port number and leave that to be retrieved from the
.authinfo file?

3. Is there a command to insert the X-Message-SMTP-Method header?

4. When entering the value for the X-Message-SMTP-Method header, is
there a way to use completion to select from available smtp servers, or
from the entries in .authinfo?

It would seem like an excessive amount of work, and error prone, to type
in something like

     X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user

every time I want to send an email.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-08  4:22       ` N. Jackson
@ 2014-02-08  6:14         ` Eric Abrahamsen
  2014-02-10 11:07           ` Rasmus
       [not found]         ` <mailman.14149.1391839983.10748.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 9+ messages in thread
From: Eric Abrahamsen @ 2014-02-08  6:14 UTC (permalink / raw)
  To: help-gnu-emacs

nljlistbox2@gmail.com (N. Jackson) writes:

> "William G Gardella" <wgg2@member.fsf.org> writes:
>> N.B. that in emacs24, you can also specify which SMTP server to use
>> for message-mode on a per message basis with an
>> "X-Message-SMTP-Method:" header, e.g.
>>
>> X-Message-SMTP-Method: smtp smtp.foo.org 465
>>
>> This eliminates much of the need for the setting of individual
>> smtpmail-* variables in these multiple accounts configurations for
>> message-mode MUAs like mu4e and Gnus.  This technique also lets you
>> switch between use of smtpmail and use of your system's local sendmail
>> binary:
>>
>> X-Message-SMTP-Method: sendmail
>>
>> See (info "(message) Mail Variables") for more info.
>
> I've been looking at using this header for in my set up for multiple
> email accounts and I find myself with questions that I haven't found the
> answers to yet in the documentation:
>
> !. Does the header get removed before the mail is sent?
>
> 2. Can one omit the port number and leave that to be retrieved from the
> .authinfo file?
>
> 3. Is there a command to insert the X-Message-SMTP-Method header?
>
> 4. When entering the value for the X-Message-SMTP-Method header, is
> there a way to use completion to select from available smtp servers, or
> from the entries in .authinfo?
>
> It would seem like an excessive amount of work, and error prone, to type
> in something like
>
>      X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
>
> every time I want to send an email.

I think the idea is to use posting styles to tell gnus to set up the
appropriate STMP method header, depending on your From address. As far
as I know, however, that means you can't cycle the From address in the
message-mode buffer and have it do the right thing. You'd have specify
the From address before the message buffer is set up. I'm looking at
this now, and I'll probably set up a wrapper around compose-mail.

I certainly hope the header gets removed...

E




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
       [not found]         ` <mailman.14149.1391839983.10748.help-gnu-emacs@gnu.org>
@ 2014-02-08 19:46           ` N. Jackson
  0 siblings, 0 replies; 9+ messages in thread
From: N. Jackson @ 2014-02-08 19:46 UTC (permalink / raw)
  To: help-gnu-emacs


Answering some of my own questions about the "X-Message-SMTP-Method"
header following some experimentation:

>> 1. Does the header get removed before the mail is sent?

Yes, it does. It would have been surprising if it didn't of course, but
I didn't see anything in the documentation that mentions this.

>> 2. Can one omit the port number and leave that to be retrieved from
>> the .authinfo file?

No. Sending the mail seems to fail if the port number is omitted.

I don't really understand what's going on here. At some point something
must be consulting my .authinfo file to retreive the password for my
smtp sever. It's not clear to me why it doesn't get the port number from
there as well.

And what about the settings of variables like smtpmail-smtp-service,
smtpmail-starttls-credentials, smtpmail-auth-credentials etc.? Do they
get factored in to the mix, or are they ignored when the
"X-Message-SMTP-Method" header is used?

>> It would seem like an excessive amount of work, and error prone, to
>> type in something like
>>
>>      X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
>>
>> every time I want to send an email.

Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> I think the idea is to use posting styles to tell gnus to set up the
> appropriate STMP method header, depending on your From address.

I'm not quite organised to use posting styles yet. In the interim I have
set up an abbrev to expand to a "From" header and
"X-Message-SMTP-Method" header for each of my smtp accounts which seems
to work well enough for the time being.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Multiple "outgoing" email accounts.
  2014-02-08  6:14         ` Eric Abrahamsen
@ 2014-02-10 11:07           ` Rasmus
  0 siblings, 0 replies; 9+ messages in thread
From: Rasmus @ 2014-02-10 11:07 UTC (permalink / raw)
  To: nljlistbox2; +Cc: help-gnu-emacs

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> nljlistbox2@gmail.com (N. Jackson) writes:
>
>> "William G Gardella" <wgg2@member.fsf.org> writes:
>>> N.B. that in emacs24, you can also specify which SMTP server to use
>>> for message-mode on a per message basis with an
>>> "X-Message-SMTP-Method:" header, e.g.
>>>
>>> X-Message-SMTP-Method: smtp smtp.foo.org 465
>>>
>>> This eliminates much of the need for the setting of individual
>>> smtpmail-* variables in these multiple accounts configurations for
>>> message-mode MUAs like mu4e and Gnus.  This technique also lets you
>>> switch between use of smtpmail and use of your system's local sendmail
>>> binary:
>>>
>>> X-Message-SMTP-Method: sendmail
>>>
>>> See (info "(message) Mail Variables") for more info.
>>
>> I've been looking at using this header for in my set up for multiple
>> email accounts and I find myself with questions that I haven't found the
>> answers to yet in the documentation:
>>
>> !. Does the header get removed before the mail is sent?
>>
>> 2. Can one omit the port number and leave that to be retrieved from the
>> .authinfo file?
>>
>> 3. Is there a command to insert the X-Message-SMTP-Method header?
>>
>> 4. When entering the value for the X-Message-SMTP-Method header, is
>> there a way to use completion to select from available smtp servers, or
>> from the entries in .authinfo?
>>
>> It would seem like an excessive amount of work, and error prone, to type
>> in something like
>>
>>      X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
>>
>> every time I want to send an email.
>
> I think the idea is to use posting styles to tell gnus to set up the
> appropriate STMP method header, depending on your From address. As far
> as I know, however, that means you can't cycle the From address in the
> message-mode buffer and have it do the right thing. You'd have specify
> the From address before the message buffer is set up. I'm looking at
> this now, and I'll probably set up a wrapper around compose-mail.

Here's a simplified version of the ugly hack I use to do this.  

(defun rasmus/compose-mail (&optional arg)
  "Compose a mail with the possibility to choose a style if ARG is non-nil"
  (interactive "P")
  (require 'gnus-util)
  (unless (gnus-alive-p) (gnus) (bury-buffer))
  (if (not arg)
        (compose-mail)
      (let* ((accounts (mapcar (lambda (x)
                                 (let ((adr (cadr (assoc 'GCC x))));; TODO: fragile
                                   (cons
                                    (replace-regexp-in-string ".*:\\([[:ascii:]]+\\)/.*" "\\1" adr)
                                    adr)))
                               gnus-posting-styles))
             (choice (ido-completing-read "Choose account" (mapcar 'car accounts)))
             (gnus-newsgroup-name (cdr-safe (assoc choice accounts))))
        (gnus-summary-mail-other-window))))


nljlistbox2@gmail.com (N. Jackson) writes:

> And what about the settings of variables like smtpmail-smtp-service,
> smtpmail-starttls-credentials, smtpmail-auth-credentials etc.? Do they
> get factored in to the mix, or are they ignored when the
> "X-Message-SMTP-Method" header is used?

You set that in your posting style as well.  Here's an example (the
eval line in the end).

  (setq gnus-posting-styles
        '(((lambda () (rasmus/gnus-posting-style-identify "school"
                       '("To" . "rasmus@school\\.edu")
                        (lambda () (pank/message-mailto-test "school\\.edu"))))
           (address "rasmus@school.eu")
           ;; (Face (gnus-convert-png-to-face (expand-file-name "school.png" gnus-face-direcotry)))
           (Organization "School")
           (GCC "nnimap+mail:school/sent")
           (X-Message-SMTP-Method "smtp server.com 587 rasmus@school.edu")
           (signature "My sig")
           (eval (setq smtpmail-stream-type nil)))))

Also, the X-message-SMTP-Method seems to be stripped from a quick test
(examining a raw message send to myself).

Hope it helps,
Rasmus

-- 
Enough with the bla bla!



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-02-10 11:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-06 20:30 Multiple "outgoing" email accounts E Sabof
2014-02-06 20:47 ` Herbert J. Skuhra
2014-02-06 22:02   ` E Sabof
2014-02-07 17:42     ` William G Gardella
     [not found]     ` <mailman.14081.1391794971.10748.help-gnu-emacs@gnu.org>
2014-02-08  4:22       ` N. Jackson
2014-02-08  6:14         ` Eric Abrahamsen
2014-02-10 11:07           ` Rasmus
     [not found]         ` <mailman.14149.1391839983.10748.help-gnu-emacs@gnu.org>
2014-02-08 19:46           ` N. Jackson
2014-02-07  0:34 ` E Sabof

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.