"Fossies" - the Fresh Open Source Software Archive

Member "msmtp-1.8.5/scripts/msmtpq/README.msmtpq" (11 Jun 2018, 9298 Bytes) of package /linux/privat/msmtp-1.8.5.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 
    2 msmtpq is a modification of the scripts comprising part of Martin Lambers'
    3 msmtpqueue package ; it attempts be useful to msmtp by holding mail sent
    4 by an MUA when a system, e.g. a laptop, is not connected to the net ;
    5 queued mails are held as files in a user defined and created queue
    6 directory ; when the machine is connected all mail can be sent directly
    7 out ; the msmtpq package does queue handling for msmtp according to the
    8 way the queue is used
    9 
   10   msmtpq        accepts mail input from an MUA (e.g. mutt) and sends it
   11                 directly out via msmtp if possible - or queues it if not
   12 
   13   msmtp-queue   is a wrapper script which simply calls msmtpq with the
   14                 --q-mgmt argument ; it exposes routines for queue
   15                 management and maintenance, that is, for queue display,
   16                 queue run (flush), mail purge from the queue, etc.
   17 
   18 msmtp-queue is interactive at the command line while msmtpq, called
   19 directly, has no interactive user input whatever - it simply takes its
   20 input from the MUA and outputs directly to msmtp (or to the queue)
   21 
   22 credit goes to Martin Lambers for the idea of the queue ; any bugs,
   23 design errors, oversights, suggestions for improvement, etc. belong to
   24 me ; all feedback is welcome ; I can be reached via the msmtp mailing
   25 list
   26 
   27 
   28 Installation :
   29 ------------
   30 
   31 copy msmtpq and msmtp-queue to whatever location is best for you
   32 (I use /usr/local/bin) ; the directory chosen should be on the path
   33 
   34 replace the msmtp invocation in your mail client with msmtpq ; e.g. for
   35 mutt : 'set sendmail = /path/to/msmtpq'
   36 
   37 msmtpq will then take care of the management and routing of outgoing
   38 mail ; normally sending a mail is nearly instantaneous, but a very long
   39 mail (e.g. one with large attachments) can take some time to make its way
   40 through ; therefore it's wise to have the MUA background the process if
   41 possible
   42 
   43 In the case of mutt, in addition to the above setting,
   44 
   45 'set sendmail = /path/to/msmtpq'
   46 
   47 set, also,
   48 
   49 'set sendmail_wait = -1'
   50 
   51 mutt then backgrounds the send and watches for a return code & message
   52 from msmtpq
   53 
   54 
   55 Configuration :
   56 -------------
   57 
   58 all config is done within the msmtpq script
   59 
   60   set the MSMTP var to point to the location of the msmtp executable
   61     (set this only if necessary ; if it's not on the path)
   62   set the Q var to point to the location of the queue directory
   63   set the LOG var to point to the location of the queue log
   64 
   65 the MSMTP variable can have the location of the msmtp executable entered
   66 into it if it is not on the path ; this might be useful in unusual
   67 circumstances, such as embedded systems, etc. ; otherwise, if you are
   68 running a normal Linux distribution you can leave it as is ; msmtp will
   69 by default be on the execution path
   70 
   71 the Q variable should have the location of the queue directory
   72 
   73 the LOG variable should have the desired name & location of the queue log
   74 
   75 the locations are clearly marked near the beginning of the script ;
   76 modify all to the locations you prefer (the defaults work for me ; you
   77 may or may not be happy with them) ... please note that it's preferable
   78 to create the queue directory (with 0700 permissions) before using these
   79 routines
   80 
   81 note that the default msmtpq set up creates a separate log for queue
   82 operations ; all operations which modify the queue in any way are logged
   83 to the queue log ; this is distinct from the msmtp log set by the
   84 'logfile' setting in .msmtprc ; I've been persuaded that it's better to
   85 have separate logs (for the distinct functions) ; if this doesn't sit
   86 well with you it's possible to define the queue log to be the same log
   87 file as the one defined in .msmtprc ; it's also possible to turn off
   88 queue logging entirely (by commenting out the 'LOG=' var - to be
   89 '#LOG=') but this seems hardly advisable, particularly before you are
   90 confident that all is working
   91 
   92 mutt users please take note of the additional setup instructions in the
   93 msmtp docs & man page.
   94 
   95 
   96 to use msmtpq with additional options :
   97 
   98 the vars : EMAIL_CONN_NOTEST (to test for a net connection or not
   99                               before attempting to send a mail)
  100 
  101                              (please note that the above var is deprecated
  102                               and will be removed in a future version of msmtpq ;
  103                               replace it with EMAIL_CONN_TEST=x
  104                               to perform the same function)
  105 
  106            EMAIL_CONN_TEST   (which test for net connection to use)
  107            EMAIL_QUEUE_QUIET (suppress unnecessary queue 'chatter')
  108 
  109 see below for their values
  110 
  111 there are two methods of setting options -
  112 
  113 
  114 - set the vars in the msmtpq script (near the top)
  115 
  116   see the script, just beneath the the three setup vars mentioned above
  117 
  118 - set the vars externally to the script
  119 
  120     define the variables as environment vars, set on the command line
  121       invoking msmtp
  122 
  123 set sendmail = "/path/to/msmtpq"
  124                  # normal config for mutt to use the queue
  125                  # (by default the ping connection test is enabled)
  126 
  127 set sendmail = "EMAIL_CONN_TEST=x /path/to/msmtpq"
  128                  # use queue without a net connection test
  129 set sendmail = "EMAIL_CONN_TEST=p /path/to/msmtpq"
  130                  # use queue with ping connection test (the default)
  131 set sendmail = "EMAIL_CONN_TEST=P /path/to/msmtpq"
  132                  # use queue with faster ping connection test
  133                  # (to an IP address, without a DNS lookup)
  134 set sendmail = "EMAIL_CONN_TEST=n /path/to/msmtpq"
  135                  # use queue with netcat connection test
  136                  # (netcat must be installed on user's system)
  137 set sendmail = "EMAIL_CONN_TEST=s /path/to/msmtpq"
  138                  # use queue with sh sockets connection test
  139                  # (this does *not* work on Debian systems ;
  140                  #  socket use is not compiled into bash for
  141                  #  security reasons on multiuser systems - it
  142                  #  may not be a serious consideration, however, on
  143                  #  single user workstations - e.g. on laptops -
  144                  #  or in embedded systems)
  145 
  146 set sendmail = "EMAIL_QUEUE_QUIET=t /path/to/msmtpq"
  147                  # use queue ; suppress messages and 'chatter'
  148                  # good, apparently, for use w/emacs MUAs
  149 
  150 set sendmail = "EMAIL_CONN_TEST=? EMAIL_QUEUE_QUIET=t /path/to/msmtpq"
  151                  # use queue w/connection test spec &
  152                  # suppression of messages and chatter
  153 
  154 externally multiple environmental vars may be used on the command
  155   line, space separated, before the msmtpq invocation ; internally
  156   to the script multiple vars may be set
  157 
  158 note that vars set internally will take precedence over vars set
  159   externally
  160 
  161 if no option is specified, by either method, the net connection test
  162   is made using the ping test by default
  163 
  164 
  165 in summary :
  166   copy the msmtpq and msmtp-queue scripts to the directory where they will live
  167     be certain that they are executable
  168       ( chmod +x msmtpq msmtp-queue )
  169   create the queue dir (0700) if necessary
  170     ( mkdir -p /path/to/queue/dir )
  171     ( chmod 0700 /path/to/queue/dir )
  172   enter or confirm the values of the three config setup vars in msmtpq
  173   enter or confirm the values of the three option vars in msmtpq - if desired
  174   for mutt users -
  175     set sendmail="/path/to/msmtpq"   (or "ANY_ENV_VARS_HERE=t /path/to/msmtpq")
  176     set sendmail_wait = -1
  177     set use_from=yes
  178     set realname="Your Name"
  179     set from=you@example.com
  180     set envelope_from=yes
  181     (and perhaps more on the msmtp man page & docs ...)
  182   for other MUAs -
  183     set the mta to '/path/to/msmtpq', as above and
  184     background its execution, if possible
  185 
  186 msmtpq is entirely self contained ; beyond keeping an eye on the queue
  187   and queue logs it should require no admin or user attention once set up
  188 
  189 
  190 log(s) rotation :
  191 
  192 On a Debian or Debian-based system (e.g. Ubuntu or Mint) a file can be
  193 created in /etc/logrotate.d (named, e.g. 'msmtp') that configures
  194 logrotate to compress and rotate both the msmtp logs and msmtpq queue
  195 logs.
  196 
  197 Suggested contents :
  198 #--------------------------------------------------
  199 /home/xyz/log/msmtp.log /home/xyz/log/msmtp.queue.log {
  200   rotate 9999
  201   weekly
  202   compress
  203   notifempty
  204   missingok
  205 }
  206 #--------------------------------------------------
  207 
  208 adjust it to your queue and log location(s) and name(s) and
  209 see the logrotate man page for further config information ;
  210 it should be trivial to adapt to other systems
  211 
  212 That's it.
  213 
  214 
  215 
  216 msmtp-queue usage :
  217 -----------------
  218 
  219 msmtp-queue offers the following options :
  220 
  221   msmtp-queue -r -- runs (flushes) all the contents of the queue
  222 
  223   msmtp-queue -R -- sends selected individual mail(s) in the queue
  224 
  225   msmtp-queue
  226   msmtp-queue -d -- displays the contents of the queue   (<-- default)
  227 
  228   msmtp-queue -p -- allows the specific purging of one or more mails
  229 
  230   msmtp-queue -a -- purges all mail in the queue
  231 
  232   msmtp-queue -h -- offers a helpful blurt
  233 
  234 ( msmtp-queue does not log the 'chatter' of user interaction but logs,
  235   to the queue log, any event that changes the queue in any way )
  236 
  237 
  238 I find it useful to have a display of the number of mails currently
  239 in the queue in conky ; it uses one shell line (in the .conkyrc script) :
  240 
  241 mailq : ${exec /bin/ls -1 ${HOME}/.msmtp.queue/*.mail 2>/dev/null | /usr/bin/wc -l}
  242 
  243 
  244 
  245 With hopes that it's useful,
  246 
  247 Chris Gianniotis