Gnus development mailing list
 help / color / mirror / Atom feed
From: Richard Riley <rileyrg@gmail.com>
To: ding@gnus.org
Subject: Re: Can't send message through smtp with gmail
Date: Thu, 28 Jun 2012 19:40:28 +0200	[thread overview]
Message-ID: <hwipeb9vxv.fsf@news.eternal-september.org> (raw)
In-Reply-To: <CAKB1TLqkybcKFCMRFUwht1kx8k3xQYUEtL9WFG41vwHsj1uxWg@mail.gmail.com>

mihkel <turakas@gmail.com> writes:

> Hi and thanks for reply.
>
> On Thu, Jun 28, 2012 at 1:28 AM, Katsumi Yamaoka <yamaoka@jpl.org> wrote:
>> (smtpmail-via-smtp RECIPIENT SMTPMAIL-TEXT-BUFFER &optional
>> ASK-FOR-PASSWORD)
>>
>> How about replacing those `(defvar ...' and `(defun ...' with
>> the defadvice form as follows rather than redefining the function?
>>
>> (defadvice smtpmail-via-smtp (before change-smtp activate)
>>  "Run `change-smtp' in advance."
>>  (with-current-buffer smtpmail-text-buffer
>>    (change-smtp)))
>>
>> This is essentially the same, but you don't have to care
>> the arguments spec change.
>
> I changed these two defvar and defun with defadvice as you suggested.
> Now when I send a message gnus asks for a SMTP user name for
> smtp.gmail.com. When I enter one, then all messages go through this
> smtp account. I have this snippet for changing smtp server according
> to "from" filed.
>
> ;; Change smtp server according to "from" field
> (defun change-smtp ()
>   "Change the SMTP server according to the current from line."
>   (save-excursion
>     (loop with from = (save-restriction
> 			(message-narrow-to-headers)
>                         (message-fetch-field "from"))
>           for (acc-type address . auth-spec) in smtp-accounts
>           when (string-match address from)
>           do (cond
>               ((eql acc-type 'plain)
>                (return (apply 'set-smtp-plain auth-spec)))
>               ((eql acc-type 'ssl)
>                (return (apply 'set-smtp-ssl auth-spec)))
>               (t (error "Unrecognized SMTP account type: '%s'." acc-type)))
>           finally (error "Cannot interfere SMTP information."))))
>
> Does the defadvice code change mentioned above break this function? I
> really have to ask you to bear with me, since I'm not a programmer...
> just a emacs user :)
>
> mihkel
>

my advice would be to use nognus and the built in multi smtp support.

in your .authinfo:

something like:

machine smtp.gmail.com login accid1 port 587 password password1
machine smtp.gmail.com login accid2 port 587 password password2

In your gnus posting styles for the group in question:-

			     (X-Message-SMTP-Method "smtp smtp.gmail.com 587 acc1")

Its there somewhere in the gnus manual. But googling for
x-message-smtp-method will show a previous thread on this.

regards

r.




  reply	other threads:[~2012-06-28 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 10:25 mihkel
2012-06-27 22:28 ` Katsumi Yamaoka
2012-06-28 15:03   ` mihkel
2012-06-28 17:40     ` Richard Riley [this message]
2012-06-28 20:45       ` mihkel
2012-06-28 23:47         ` Richard Riley
2012-06-29  6:46           ` mihkel
2012-06-29  9:29             ` Richard Riley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=hwipeb9vxv.fsf@news.eternal-september.org \
    --to=rileyrg@gmail.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).