Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: wgreenhouse-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org (W. Greenhouse)
To: info-gnus-english-mXXj517/zsQ@public.gmane.org
Subject: Re: Gcc is ignored when sending mail from emacs lisp
Date: Sat, 11 May 2013 19:39:44 +0000	[thread overview]
Message-ID: <87zjw1nw5b.fsf@riseup.net> (raw)
In-Reply-To: <87fvxvvtp7.fsf@gmail.com>

Hi Alexander,

Alexander Baier <lexi.baier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hello,
>
> I want to sent mail from emacs lisp code, but the given Gcc-field is not
> considered by the send function and thus no mail is put into my "Sent
> Items" Group/Folder.  When I send a mail from within gnus, everything
> works out fine.  This is the relevant code:
>
> Sending mail from outside gnus:
> (defun org-tut-send-mail ()
>   (message-mail "my.email-+LBmYUDmh58@public.gmane.org"
>                 "[ELISP-TEST] Test"
>                 '(("From" . "my.email-+LBmYUDmh58@public.gmane.org")
>                   ("Gcc" . "nnimap+imap.server.com:\"Sent Items\"")))
>   (insert "SOME TEXT")
>   (message-send-and-exit))
>
> The above snippet sends the Email just fine, but nothing gets stored in
> my Sent Items group.
>
> Can anybody give me some pointers on this?
>
> PS: If you need further information, name it and I will gladly provide
> it.

Is Gnus up and running during the evaluation of this function?  Although
Message is a [sort of] free-standing library rather than just a part of
Gnus, the capabilities of message-mode, especially with regard to the
Gcc: header, depend on whether Gnus is active at the time of evaluation
or not.

When Gnus is down, message-mode can't do fancy things with sent mail,
like uploading it to an IMAP folder as in your example.  I wouldn't be
surprised if your sent mail from this function is ending up inside
`message-directory', probably in the default monthly archive file,
e.g. "~/Mail/archive/sent/2013-05".

If you want your function to always honor Gcc: headers even if they
point to something like an IMAP folder or other group that requires
Gnus's capabilities to use, your function should check the return value
of (gnus-alive-p) to see if Gnus is running, and possibly activate it
before continuing.

-- 
BOFH excuse #292:

We ran out of dial tone and we're and waiting for the phone company to
deliver another bottle.

  reply	other threads:[~2013-05-11 19:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 13:40 Alexander Baier
2013-05-11 19:39 ` W. Greenhouse [this message]
2013-05-13 10:59   ` Alexander Baier
     [not found]   ` <mailman.25652.1368464412.855.info-gnus-english@gnu.org>
2013-08-01 11:53     ` Lars Magne Ingebrigtsen
2013-09-08 23:10       ` Alexander Baier
     [not found]       ` <mailman.1627.1378681833.10748.info-gnus-english@gnu.org>
2013-12-26  0:00         ` Lars Ingebrigtsen
2013-12-26  0:13           ` Alexander Baier

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=87zjw1nw5b.fsf@riseup.net \
    --to=wgreenhouse-sgozh3hwpm2stnjn9+bgxg@public.gmane.org \
    --cc=info-gnus-english-mXXj517/zsQ@public.gmane.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).