LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2018, 05:26 AM   #1
guido.vc
LQ Newbie
 
Registered: Jan 2015
Posts: 2

Rep: Reputation: Disabled
mutt not saving sent mails in IMAP folder when using in script or command line


Hello, just found out about MUTT and I want to use it to SEND mail from command line or script via an EXCHANGE account, here is my .muttrc file:
Quote:
set folder="imap://<user>:<passwd>@<EXCHANGE-SRV>" (our EXCHANGE server)
set from="<user>@<mydomain>"
set realname='Technische Dienst'
set spoolfile="imap://<user>:<passwd>@<EXCHANGE-SRV>"
set copy=yes
set record="+VERZONDEN ITEMS"

set certificate_file=.mutt-certs

set ssl_starttls=yes
set ssl_force_tls=yes

set smtp_url="smtp://fid-exch"
when starting mutt and sending the mail from within the MUTT program all works well and a copy of the sent mail is saved in the folder VERZONDEN ITEMS, but when when I send the mail from command line like this, the sent mail is NOT saved:
Quote:
mutt -s TEST guido.vc@scarlet.be </etc/message
looking at the debug files in both situations, it seems that the IMAP part of .muttrc is not processed when sending from command line

This is the debug file when sending from within MUTT:
Quote:
[2018-04-30 11:12:17] Mutt/1.5.23 (2014-03-12) debugging at level 2
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc'.
[2018-04-30 11:12:17] Reading configuration file '/usr/lib/mutt/source-muttrc.d|'.
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc.d/charset.rc'.
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc.d/colors.rc'.
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc.d/compressed-folders.rc'.
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc.d/gpg.rc'.
[2018-04-30 11:12:17] Reading configuration file '/etc/Muttrc.d/smime.rc'.
[2018-04-30 11:12:17] Reading configuration file '/home/informix/.muttrc'.
[2018-04-30 11:12:25] Sending message...
[2018-04-30 11:12:25] Looking up <EXCH-SRV>...
[2018-04-30 11:12:30] Connecting to <EXCH-SRV>...
[2018-04-30 11:12:30] Connected to <EXCH-SRV>:143 on fd=5
[2018-04-30 11:12:30] 5< * OK The Microsoft Exchange IMAP4 service is ready.
[2018-04-30 11:12:30] 5> a0000 CAPABILITY
[2018-04-30 11:12:30] 5< * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=NTLM AUTH=GSSAPI STARTTLS UIDPLUS MOVE ID CHILDREN IDLE NAMESPACE LITERAL+
[2018-04-30 11:12:30] 5< a0000 OK CAPABILITY completed.
[2018-04-30 11:12:30] 5> a0001 STARTTLS
[2018-04-30 11:12:30] 5< a0001 OK Begin TLS negotiation now.
[2018-04-30 11:12:30] SSL/TLS connection using TLS1.2 (ECDHE-RSA/AES-256-CBC/SHA384)
[2018-04-30 11:12:31] 5> a0002 CAPABILITY
[2018-04-30 11:12:31] 5< * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=NTLM AUTH=GSSAPI UIDPLUS MOVE ID CHILDREN IDLE NAMESPACE LITERAL+
[2018-04-30 11:12:31] 5< a0002 OK CAPABILITY completed.
[2018-04-30 11:12:31] imap_authenticate: Using any available method.
[2018-04-30 11:12:31] SASL local ip: 192.168.1.215;56580, remote ip:192.168.1.12;143
[2018-04-30 11:12:31] External SSF: 256
[2018-04-30 11:12:31] External authentication name: <USER>
[2018-04-30 11:12:31] mutt_sasl_cb_authname: getting authname for <EXCH-SRV>:143
[2018-04-30 11:12:31] mutt_sasl_cb_authname: getting user for <EXCH-SRV>:143
[2018-04-30 11:12:31] mutt_sasl_cb_pass: getting password for <USER>@<EXCH-SRV>:143
[2018-04-30 11:12:31] Authenticating (PLAIN)...
[2018-04-30 11:12:31] 5> a0003 AUTHENTICATE PLAIN
[2018-04-30 11:12:31] 5< +
[2018-04-30 11:12:31] 5> dGQAdGQAQWRtaW43NDE1Ng==
[2018-04-30 11:12:31] 5< a0003 OK AUTHENTICATE completed.
[2018-04-30 11:12:31] Communication encrypted at 256 bits
[2018-04-30 11:12:31] 5> a0004 CAPABILITY
a0005 LIST "" ""
[2018-04-30 11:12:31] 5< * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=NTLM AUTH=GSSAPI UIDPLUS MOVE ID XPROXY3 CHILDREN IDLE NAMESPACE LITERAL+
[2018-04-30 11:12:31] 5< a0004 OK CAPABILITY completed.
[2018-04-30 11:12:31] 5< * LIST (\Noselect \HasChildren) "/" ""
[2018-04-30 11:12:31] 5< a0005 OK LIST completed.
[2018-04-30 11:12:31] 5> a0006 STATUS "VERZONDEN ITEMS" (UIDVALIDITY)
[2018-04-30 11:12:31] 5< * STATUS "Verzonden items" (UIDVALIDITY 11)
[2018-04-30 11:12:31] 5< a0006 OK STATUS completed.
[2018-04-30 11:12:31] Uploading message... 0K/0.3K (0%)
[2018-04-30 11:12:31] 5> a0007 APPEND "VERZONDEN ITEMS" (\Seen) "30-Apr-2018 11:12:25 +0200" {331}
[2018-04-30 11:12:31] 5< + Ready for additional command text.
[2018-04-30 11:12:31] 5> Date: Mon, 30 Apr 2018 11:12:31 +0200
From: Technische Dienst <<USER>@<EMAILDOMAIN>>
To: guido.vc@scarlet.be
Subject: TESTTEST
Message-ID: <20180430091225.GA3576@debian.<MYDOMAIN>>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.23 (2014-03-12)

qsdf
[2018-04-30 11:12:31] 5>
[2018-04-30 11:12:31] 5< a0007 OK [APPENDUID 11 57] APPEND completed.
[2018-04-30 11:12:31] mx_close_message (): unlinking /tmp/mutt-debian-1000-3576-836786001658084954
[2018-04-30 11:12:31] Looking up <EXCH-SRV>...
[2018-04-30 11:12:31] Connecting to <EXCH-SRV>...
[2018-04-30 11:12:31] Connected to <EXCH-SRV>:25 on fd=6
[2018-04-30 11:12:31] 6< 220 <EXCH-SRV>.<MYDOMAIN> Microsoft ESMTP MAIL Service ready at Mon, 30 Apr 2018 11:12:34 +0200
[2018-04-30 11:12:31] 6> EHLO debian.<MYDOMAIN>
[2018-04-30 11:12:31] 6< 250-<EXCH-SRV>.<MYDOMAIN> Hello [192.168.1.215]
[2018-04-30 11:12:31] 6< 250-SIZE 36700160
[2018-04-30 11:12:31] 6< 250-PIPELINING
[2018-04-30 11:12:31] 6< 250-DSN
[2018-04-30 11:12:31] 6< 250-ENHANCEDSTATUSCODES
[2018-04-30 11:12:31] 6< 250-STARTTLS
[2018-04-30 11:12:31] 6< 250-8BITMIME
[2018-04-30 11:12:31] 6< 250-BINARYMIME
[2018-04-30 11:12:31] 6< 250 CHUNKING
[2018-04-30 11:12:31] 6> STARTTLS
[2018-04-30 11:12:31] 6< 220 2.0.0 SMTP server ready
[2018-04-30 11:12:31] SSL/TLS connection using TLS1.2 (ECDHE-RSA/AES-256-CBC/SHA384)
[2018-04-30 11:12:32] 6> EHLO debian.<MYDOMAIN>
[2018-04-30 11:12:32] 6< 250-<EXCH-SRV>.<MYDOMAIN> Hello [192.168.1.215]
[2018-04-30 11:12:32] 6< 250-SIZE 36700160
[2018-04-30 11:12:32] 6< 250-PIPELINING
[2018-04-30 11:12:32] 6< 250-DSN
[2018-04-30 11:12:32] 6< 250-ENHANCEDSTATUSCODES
[2018-04-30 11:12:32] 6< 250-8BITMIME
[2018-04-30 11:12:32] 6< 250-BINARYMIME
[2018-04-30 11:12:32] 6< 250 CHUNKING
[2018-04-30 11:12:32] 6> MAIL FROM:<<USER>@<EMAILDOMAIN>>
[2018-04-30 11:12:32] 6< 250 2.1.0 Sender OK
[2018-04-30 11:12:32] 6> RCPT TO:<guido.vc@scarlet.be>
[2018-04-30 11:12:32] 6< 250 2.1.5 Recipient OK
[2018-04-30 11:12:32] Sending message... 0K/0.3K (0%)
[2018-04-30 11:12:32] 6> DATA
[2018-04-30 11:12:32] 6< 354 Start mail input; end with <CRLF>.<CRLF>
[2018-04-30 11:12:32] 6> .
[2018-04-30 11:12:33] 6< 250 2.6.0 <20180430091225.GA3576@debian.<MYDOMAIN>> [InternalId=132955007614996, Hostname=<EXCH-SRV>.<MYDOMAIN>] Queued mail for delivery
[2018-04-30 11:12:33] 6> QUIT
[2018-04-30 11:12:33] Mail sent.
[2018-04-30 11:12:33] mutt_free_body: unlinking /tmp/mutt-debian-1000-3576-1791650845755713463.
and this is the debug file when sending from command line:
Quote:
[2018-04-30 11:12:48] Mutt/1.5.23 (2014-03-12) debugging at level 2
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc'.
[2018-04-30 11:12:48] Reading configuration file '/usr/lib/mutt/source-muttrc.d|'.
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc.d/charset.rc'.
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc.d/colors.rc'.
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc.d/compressed-folders.rc'.
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc.d/gpg.rc'.
[2018-04-30 11:12:48] Reading configuration file '/etc/Muttrc.d/smime.rc'.
[2018-04-30 11:12:48] Reading configuration file '/home/informix/.muttrc'.
[2018-04-30 11:12:48] Connected to <EXCH-SRV>:25 on fd=5
[2018-04-30 11:12:48] 5< 220 <EXCH-SRV>.<MYDOMAIN> Microsoft ESMTP MAIL Service ready at Mon, 30 Apr 2018 11:12:51 +0200
[2018-04-30 11:12:48] 5> EHLO debian.<MYDOMAIN>
[2018-04-30 11:12:48] 5< 250-<EXCH-SRV>.<MYDOMAIN> Hello [192.168.1.215]
[2018-04-30 11:12:48] 5< 250-SIZE 36700160
[2018-04-30 11:12:48] 5< 250-PIPELINING
[2018-04-30 11:12:48] 5< 250-DSN
[2018-04-30 11:12:48] 5< 250-ENHANCEDSTATUSCODES
[2018-04-30 11:12:48] 5< 250-STARTTLS
[2018-04-30 11:12:48] 5< 250-8BITMIME
[2018-04-30 11:12:48] 5< 250-BINARYMIME
[2018-04-30 11:12:48] 5< 250 CHUNKING
[2018-04-30 11:12:48] 5> STARTTLS
[2018-04-30 11:12:48] 5< 220 2.0.0 SMTP server ready
[2018-04-30 11:12:48] 5> EHLO debian.<MYDOMAIN>
[2018-04-30 11:12:48] 5< 250-<EXCH-SRV>.<MYDOMAIN> Hello [192.168.1.215]
[2018-04-30 11:12:48] 5< 250-SIZE 36700160
[2018-04-30 11:12:48] 5< 250-PIPELINING
[2018-04-30 11:12:48] 5< 250-DSN
[2018-04-30 11:12:48] 5< 250-ENHANCEDSTATUSCODES
[2018-04-30 11:12:48] 5< 250-8BITMIME
[2018-04-30 11:12:48] 5< 250-BINARYMIME
[2018-04-30 11:12:48] 5< 250 CHUNKING
[2018-04-30 11:12:48] 5> MAIL FROM:<<USER>@<EMAILDOMAIN>>
[2018-04-30 11:12:48] 5< 250 2.1.0 Sender OK
[2018-04-30 11:12:48] 5> RCPT TO:<guido.vc@scarlet.be>
[2018-04-30 11:12:48] 5< 250 2.1.5 Recipient OK
[2018-04-30 11:12:48] 5> DATA
[2018-04-30 11:12:48] 5< 354 Start mail input; end with <CRLF>.<CRLF>
[2018-04-30 11:12:48] 5> .
[2018-04-30 11:12:48] 5< 250 2.6.0 <20180430091248.GA3582@debian.<MYDOMAIN>> [InternalId=132955007614997, Hostname=<EXCH-SRV>.<MYDOMAIN>] Queued mail for delivery
[2018-04-30 11:12:48] 5> QUIT
[2018-04-30 11:12:48] mutt_free_body: unlinking /tmp/mutt-debian-1000-3582-15533261881262299722.
hoping that someone can help, thanks in advance
 
Old 04-30-2018, 11:11 PM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,511

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
This is where I think it puts the message in the box
Quote:
[2018-04-30 11:12:31] 5> a0007 APPEND "VERZONDEN ITEMS" (\Seen) "30-Apr-2018 11:12:25 +0200" {331}
The command line doesn't have that line. So, it's probably a switch you've left out in when using the command line.
 
Old 05-01-2018, 03:12 AM   #3
guido.vc
LQ Newbie
 
Registered: Jan 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Hi AwesomeMachine, thanks for the reply but all the necessary switches or options should be in the .muttrc file.
the first debug file is generated by the command
Quote:
mutt -s TEST guido.vc@scarlet.be
which starts the mutt interface to finish the sending of the mail
the second debug file is generated by the command
Quote:
mutt -s TEST guido.vc@scarlet.be </etc/message
which immediately sends the mail

it's true that i'm missing something but i can't figure out what
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can not send email in command line with mutt golden_boy615 Linux - Networking 6 12-31-2011 02:12 PM
[SOLVED] how to refresh for new mails from command line dinakumar12 Linux - Newbie 7 02-14-2011 02:00 AM
LXer: A month on the command line, Day 15: I get POP into mutt LXer Syndicated Linux News 0 05-18-2007 07:47 AM
LXer: A month on the command line, Day 12: Mutt barks! LXer Syndicated Linux News 1 05-15-2007 08:39 AM
send email with mutt on command line naijaguy Linux - General 1 12-29-2004 07:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration