Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Gcc is ignored when sending mail from emacs lisp
@ 2013-05-10 13:40 Alexander Baier
  2013-05-11 19:39 ` W. Greenhouse
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Baier @ 2013-05-10 13:40 UTC (permalink / raw)
  To: info-gnus-english

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:
--8<---------------cut here---------------start------------->8---
(defun org-tut-send-mail ()
  (message-mail "my.email@foo.com"
                "[ELISP-TEST] Test"
                '(("From" . "my.email@foo.com")
                  ("Gcc" . "nnimap+imap.server.com:\"Sent Items\"")))
  (insert "SOME TEXT")
  (message-send-and-exit))
--8<---------------cut here---------------end--------------->8---

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.

Regards,
Alex

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

* Re: Gcc is ignored when sending mail from emacs lisp
  2013-05-10 13:40 Gcc is ignored when sending mail from emacs lisp Alexander Baier
@ 2013-05-11 19:39 ` W. Greenhouse
  2013-05-13 10:59   ` Alexander Baier
       [not found]   ` <mailman.25652.1368464412.855.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 7+ messages in thread
From: W. Greenhouse @ 2013-05-11 19:39 UTC (permalink / raw)
  To: info-gnus-english-mXXj517/zsQ

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.

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

* Re: Gcc is ignored when sending mail from emacs lisp
  2013-05-11 19:39 ` W. Greenhouse
@ 2013-05-13 10:59   ` Alexander Baier
       [not found]   ` <mailman.25652.1368464412.855.info-gnus-english@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Baier @ 2013-05-13 10:59 UTC (permalink / raw)
  To: info-gnus-english

Hello W. Greenhouse,

thank you for your fast reply!

wgreenhouse-sGOZH3hwPm2sTnJN9+BGXg@public.gmane.org (W. Greenhouse)
writes:
> 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".
>
They do not seem to end up in any local group on my disk.

> 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.
I changed my code to something like this:
--8<---------------cut here---------------start------------->8---
(defun org-tut-send-mail ()
  (if (gnus-alive-p)
      (progn
        (message-mail "my.email@foo.com"
                      "[ELISP-TEST] Test"
                      '(("From" . "my.email@foo.com")
                        ("Gcc" . "nnimap+imap.server.com:\"Sent Items\"")))
        (insert "SOME TEXT")
        (message-send-and-exit))
    (message "Could not send mail, gnus is not alive.")))
--8<---------------cut here---------------end--------------->8---

(gnus-alive-p) returnes t, which is correct, as I have a running
instance of gnus.  The results however are the save as with no running
gnus, still no Mail in my Sent Items folder.

Is there any log that would provide useful information?


Regards,
Alex

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

* Re: Gcc is ignored when sending mail from emacs lisp
       [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>
  0 siblings, 2 replies; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 11:53 UTC (permalink / raw)
  To: Alexander Baier; +Cc: info-gnus-english

Alexander Baier <lexi.baier@gmail.com> writes:

>                         ("Gcc" . "nnimap+imap.server.com:\"Sent Items\"")))

Hm...  is it possible that the spaces in the group name is the problem
here?  I haven't tested myself...

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php

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

* Re: Gcc is ignored when sending mail from emacs lisp
  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>
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Baier @ 2013-09-08 23:10 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: info-gnus-english

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Alexander Baier <lexi.baier@gmail.com> writes:
>
>>                         ("Gcc" . "nnimap+imap.server.com:\"Sent Items\"")))
>
> Hm...  is it possible that the spaces in the group name is the problem
> here?  I haven't tested myself...

There is another folder on the IMAP server
"nnimap+imap.server.com:Sent" that I tried without luck: When I
subscribe to said group to see if there is new mail, nothing has
arrived. The same is true for all the other folders I have acces to on
that server. 

Maybe this is a problem with the IMAP server? As far as I know, this is
some Microsoft product, as I can also use Microsoft Office Outlook Web
Access to view my mail in the browser.

How do I create some kind of temporary group, so I can test, if gnus
might be moving mail to that directory.


Best regards,

Alex

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

* Re: Gcc is ignored when sending mail from emacs lisp
       [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
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2013-12-26  0:00 UTC (permalink / raw)
  To: Alexander Baier; +Cc: info-gnus-english

Alexander Baier <lexi.baier@gmail.com> writes:

> How do I create some kind of temporary group, so I can test, if gnus
> might be moving mail to that directory.

You can create groups by, for instance, copying a message to that group.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/

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

* Re: Gcc is ignored when sending mail from emacs lisp
  2013-12-26  0:00         ` Lars Ingebrigtsen
@ 2013-12-26  0:13           ` Alexander Baier
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Baier @ 2013-12-26  0:13 UTC (permalink / raw)
  To: info-gnus-english

On 2013-12-26 01:00 Lars Ingebrigtsen wrote:
> Alexander Baier <lexi.baier@gmail.com> writes:
>
>> How do I create some kind of temporary group, so I can test, if gnus
>> might be moving mail to that directory.
>
> You can create groups by, for instance, copying a message to that group.

Thanks.  I will see if I get this working again and report back.

-- 
 Alexander Baier

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

end of thread, other threads:[~2013-12-26  0:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 13:40 Gcc is ignored when sending mail from emacs lisp Alexander Baier
2013-05-11 19:39 ` W. Greenhouse
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

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).