diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | LICENSE | 674 | ||||
-rw-r--r-- | LICENSE.md | 3 | ||||
-rw-r--r-- | README.md | 123 | ||||
-rw-r--r-- | autoconf/domains.csv | 41 | ||||
-rw-r--r-- | autoconf/msmtprc_header | 6 | ||||
-rw-r--r-- | autoconf/msmtprc_profile | 7 | ||||
-rw-r--r-- | autoconf/mutt_profile | 4 | ||||
-rw-r--r-- | autoconf/offlineimap_header.macos | 6 | ||||
-rw-r--r-- | autoconf/offlineimap_profile | 7 | ||||
-rw-r--r-- | autoconf/offlineimap_profile.macos | 19 | ||||
-rwxr-xr-x | credentials/getmuttpass | 3 | ||||
-rw-r--r-- | etc/email.gif | bin | 0 -> 7545 bytes | |||
-rwxr-xr-x | etc/htmlopen.sh | 10 | ||||
-rw-r--r-- | etc/mailcap | 16 | ||||
-rwxr-xr-x | etc/mailsync.sh | 44 | ||||
-rw-r--r-- | etc/muttcol | 115 | ||||
-rw-r--r-- | etc/notify.opus | bin | 0 -> 28900 bytes | |||
-rwxr-xr-x | etc/view_attachment.sh | 127 | ||||
-rwxr-xr-x | mutt-wizard.sh | 145 | ||||
-rw-r--r-- | muttrc | 49 |
21 files changed, 1231 insertions, 170 deletions
@@ -4,3 +4,5 @@ accounts/ *.pyc personal.muttrc thunderbird/ +autoconf/log +etc/mailsynclastrun @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index f49c226..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,3 +0,0 @@ -# License - -GPLv3. @@ -2,69 +2,128 @@ ![mutt wizard preview](etc/mw.png) -Mutt is one of the most rewarding programs one can use, but can be a pain in the ass to configure. Since my job is making power-user tools available for the masses I want to create a tool that automates most of mutt configuration so that users can simply give their email address and get a /comfy/ setup. At that, I don't just want a mutt wizard, but an offlineIMAP wizard, so users can easily access their mail offline as well, and a wizard that makes it easy to store passwords securely using gpg. - -The mutt-wizard is all of this in a simple ncurses menu. It's really just a little bash script, but one that can save countless people thousands of combined manhours of frustratingly trying to get all the moving pieces working together. +Mutt is one of the most rewarding programs one can use, but can be a pain in +the ass to configure. Since my job is making power-user tools available for the +masses I want to create a tool that automates most of mutt configuration so +that users can simply give their email address and get a /comfy/ setup. At +that, I don't just want a mutt wizard, but an offlineIMAP wizard, so users can +easily access their mail offline as well, and a wizard that makes it easy to +store passwords securely using gpg. + +The mutt-wizard is all of this in a simple ncurses menu. It's really just a +little bash script, but one that can save countless people thousands of +combined manhours of frustratingly trying to get all the moving pieces working +together. ## User interface -The system takes an email and autodetect its server settings, generating a muttrc and offlineimaprc profile automatically. If it can't do so, it simply prompts you for these (which you can easily look up) and will put them all in the right places. You get: - -+ Automatic configuration of mutt and offlineimap -+ Automatic encryption and safe storage of passwords which are used by mutt and offlineimap when necessary -+ Multiple account management in mutt: jump from account to account with the `i` prefix in mutt: `i1`: first email account, `i5`: fifth, etc. -+ Easy movement to mail folders in mutt: `gi`: go to inbox, `gs` to sent mail, `ga` to archive, `gS` to spam, `gd` to drafts, etc. -+ Some default controls and colors. This system is going to be integrated into my [public auto-rice script](https://larbs.xyz) so I want it to look pretty and be usable out the box. +The system takes an email and autodetect its server settings, generating a +muttrc and offlineimaprc profile automatically. If it can't do so, it simply +prompts you for these (which you can easily look up) and will put them all in +the right places. You get: + ++ Automatic configuration of mutt and offlineimap. ++ Automatic encryption and safe storage of passwords which are used by mutt and + offlineimap when necessary. ++ Multiple account management in mutt: jump from account to account with the + `i` prefix in mutt: `i1`: first email account, `i5`: fifth, etc. ++ Easy movement to mail folders in mutt: `gi`: go to inbox, `gs` to sent mail, + `ga` to archive, `gS` to spam, `gd` to drafts, etc. ++ Some default controls and colors. This system is going to be integrated into + my [public auto-rice script](https://larbs.xyz) so I want it to look pretty + and be usable out the box. ++ An optional autosync script that will smartly run offlineimap when connected + to the internet at what interval you want and will notify you with a ding + when new mail arrives. ### Will it work on my email? (95% yes) -Yes! At this point, the only problems are the unexpected ones. Please try it, and if you do run into problems, email me at [luke@lukesmith.xyz](mailto:luke@lukesmith.xyz)! I've tried the system personally on Gmail, Teknik.io, cock.li and Yandex, while others have tried other providers. +Yes! At this point, the only problems are the unexpected ones. Please try it, +and if you do run into problems, email me at +[luke@lukesmith.xyz](mailto:luke@lukesmith.xyz)! I've tried the system +personally on Gmail, Teknik.io, cock.li and Yandex, while others have tried +other providers. -One email provider which I think will *not* work (and will never work) is Proton Mail, but that's only because they require encryption through their web client IIRC. +One email provider which I think will *not* work (and will never work) is +Proton Mail, but that's only because they require encryption through their web +client IIRC. -Note also that Gmail and some providers require you to enable sign-ins from third-party (or as they call it "less secure") applications to be able to load mail with mutt and offlineimap. Be sure to enable that! +Note also that Gmail and some providers require you to enable sign-ins from +third-party (or as they call it "less secure") applications to be able to load +mail with mutt and offlineimap. Be sure to enable that! ## Installation and Dependencies -`dialog`, `neomutt` and `offlineimap` should be installed. You also need to have a GPG public/private key pair for the wizard to automatically store your passwords. The whole repo should be cloned to `~/.config/mutt/`. (If you have a previous mutt folder, you'll want to back it up or delete it first.) +`dialog`, `neomutt`, `offlineimap` and `msmtp` should be installed. You also need to +have a GPG public/private key pair for the wizard to automatically store your +passwords. The whole repo should be cloned to `~/.config/mutt/`. (If you have a +previous mutt folder, you'll want to back it up or delete it first.) ``` git clone https://github.com/LukeSmithxyz/mutt-wizard.git ~/.config/mutt ``` -You will want to delete or rename your current `~/.offlineimaprc` as well, as although you can later modify the `~/.offlineimaprc` produced by the script, you must have no file there the first time you add your first account or the wizard will assume some settings are already set which aren't. - -Just run `mutt-wizard.sh` for all the options, to install an account: - -* First, select the "Add an account" option and give the script your account information. -* Second, in a separate terminal, start your mail sync by running `offlineimap` or `offlineimap -a <your account name>`. This will start downloading all your mail for offline access. -* Third, once your mailbox has started to download, reenter the script and select the "Auto-detect mailboxes" open. This will finalize the install and let you open up mutt to see your mail. +You will want to delete or rename your current `~/.offlineimaprc` and +`~/.msmtprc` as well, as although you can later modify these files produced by +the script, you must have no file there the first time you add your first +account or the wizard will assume some settings are already set which aren't. -Whenever you want to check for mail, just run the `offlineimap` command again. +Just run `mutt-wizard.sh` and choose to add an account. After you do so, you +may run `offlineimap` to begin the mailsync, and you will be able to run +neomutt and see your mail. If mutt doesn't immediately work properly run the +`Redetect mailboxes` option, then open mutt. This may be necessary for some +accounts. ### Non-essential dependencies -The automatically deployed configs will look for certain programs for certain extra abilities. Consider installing the following for the extra functionality. +The automatically deployed configs will look for certain programs for certain +extra abilities. Consider installing the following for the extra functionality. -+ `urlview` -- Detecting and following links with `ctrl-u` -+ `mupdf` -- for viewing attached pdfs (`v` to view attachments, then select .pdf) -+ `notmuch` -- for mail searching and indexing set to `ctrl-f`. Be sure to run `notmuch setup`. Remember your mail is in `~/.mail/` when you configure notmuch. ++ `urlscan` -- Detecting and following links with `ctrl-u` ++ `mupdf` -- for viewing attached pdfs (`v` to view attachments, then select + .pdf) ++ `notmuch` -- for mail searching and indexing set to `ctrl-f`. Be sure to run + `notmuch setup`. Remember your mail is in `~/.mail/` when you configure + notmuch. + `w3m` and/or `w3mimg` -- for viewing images. Like .pdfs, view in the attachments menu. ++ A cron manager if you want the autosync feature. ++ `iproute2mac` for Mac users who want the autosync feature. ++ `mpv` if you want the autosync feature to notify you with a ding on new mail. -### "Wait? The script asks for my passwords?" +## The autosync + +If you activate the autosync at a significantly infrequent interval, by +default, your system might prompt you for your GPG password every time. To +prevent this, you can change the time a GPG unlock lasts by adding a time in +seconds as below into `~/.gnupg/gpg-agent.conf`: + +``` +default-cache-ttl <number-of-seconds> +max-cache-ttl <number-of-seconds> +``` -Look at the code. The script takes the passwords you give it, encrypts them immediately with your own GPG key, and shreds the leftovers. Nothing malicious; it's all there! If it makes you comfortable you can even run the script offline at first. +You can also use [pam-gnupg](https://github.com/cruegge/pam-gnupg) if you want +to just log into your keyring immediately on log in. This is what I do, but +it's less secure if you leave you computer logged on. ## You can help! -If you use mutt with a particular host or domain, put your server information in `domains.csv`! This will make everyone else who uses your email provider's life much easier! +If you use mutt with a particular host or domain, put your server information +in `domains.csv`! This will make everyone else who uses your email provider's +life much easier! -Or you can help monetarily via [Patreon](https://patreon.com/lukesmith) or [Paypal](https://paypal.me/LukeMSmith)! +Or you can help monetarily via [Patreon](https://patreon.com/lukesmith) or +[Paypal](https://paypal.me/LukeMSmith)! ## Notes -Mail is stored in `~/.mail`. mutt configs and caches for each account are in `~/.config/mutt/accounts/`. Encypted passwords are in `~/.config/mutt/credentials`. A "personal" muttrc, with the macros for switching accounts and the default config is in `~/.config/mutt/personal.muttrc`. +Mail is stored in `~/.mail`. mutt configs and caches for each account are in +`~/.config/mutt/accounts/`. Encypted passwords are in +`~/.config/mutt/credentials`. A "personal" muttrc, with the macros for +switching accounts and the default config is in +`~/.config/mutt/personal.muttrc`. ## Todo -* Expand the list of server information in `domains.csv`, possibly porting the Thunderbird autoconfigure settings. +* Expand the list of server information in `domains.csv`, possibly porting the + Thunderbird autoconfigure settings. diff --git a/autoconf/domains.csv b/autoconf/domains.csv index 70b2416..46113fd 100644 --- a/autoconf/domains.csv +++ b/autoconf/domains.csv @@ -3,13 +3,13 @@ ADDRESS,IMAP,imap port,SMTP,smtp port 8chan.co,mail.cock.li,993,mail.cock.li,587 aaathats3as.com,mail.cock.li,993,mail.cock.li,587 accountant.com,imap.mail.com,995,smtp.mail.com,587 -accountant.com,imap.mail.com,995,smtp.mail.com,587 activist.com,imap.mail.com,995,smtp.mail.com,587 adexec.com,imap.mail.com,995,smtp.mail.com,587 airmail.cc,mail.cock.li,993,mail.cock.li,587 allergist.com,imap.mail.com,995,smtp.mail.com,587 alumni.com,imap.mail.com,995,smtp.mail.com,587 alumnidirector.com,imap.mail.com,995,smtp.mail.com,587 +anche.no,mail.autistici.org,993,smtp.autistici.org,465 angelic.com,imap.mail.com,995,smtp.mail.com,587 aol.com,imap.aol.com,993,smtp.aol.com,465 appraiser.net,imap.mail.com,995,smtp.mail.com,587 @@ -17,15 +17,21 @@ archaeologist.com,imap.mail.com,995,smtp.mail.com,587 arcticmail.com,imap.mail.com,995,smtp.mail.com,587 artlover.com,imap.mail.com,995,smtp.mail.com,587 asia.com,imap.mail.com,995,smtp.mail.com,587 -asia.com,imap.mail.com,995,smtp.mail.com,587 auctioneer.net,imap.mail.com,995,smtp.mail.com,587 +autistiche.org,mail.autistici.org,993,smtp.autistici.org,465 +autistici.org,mail.autistici.org,993,smtp.autistici.org,465 +autoproduzioni.net,mail.autistici.org,993,smtp.autistici.org,465 bartender.net,imap.mail.com,995,smtp.mail.com,587 +bastardi.net,mail.autistici.org,993,smtp.autistici.org,465 bguth.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 bikerider.com,imap.mail.com,995,smtp.mail.com,587 billycarlyle.uk,mail.muny.us,993,mail.muny.us,465 birdlover.com,imap.mail.com,995,smtp.mail.com,587 bjoernguthphotography.de,wp300.webpack.hosteurope.de,993,wp300.webpack.hosteurope.de,587 brew-meister.com,imap.mail.com,995,smtp.mail.com,587 +bruttocarattere.org,mail.autistici.org,993,smtp.autistici.org,465 +canaglie.net,mail.autistici.org,993,smtp.autistici.org,465 +canaglie.org,mail.autistici.org,993,smtp.autistici.org,465 cash4u.com,imap.mail.com,995,smtp.mail.com,587 cheerful.com,imap.mail.com,995,smtp.mail.com,587 chef.net,imap.mail.com,995,smtp.mail.com,587 @@ -41,23 +47,25 @@ columnist.com,imap.mail.com,995,smtp.mail.com,587 comic.com,imap.mail.com,995,smtp.mail.com,587 computer4u.com,imap.mail.com,995,smtp.mail.com,587 consultant.com,imap.mail.com,995,smtp.mail.com,587 -consultant.com,imap.mail.com,995,smtp.mail.com,587 -contractor.net,imap.mail.com,995,smtp.mail.com,587 contractor.net,imap.mail.com,995,smtp.mail.com,587 coolsite.net,imap.mail.com,995,smtp.mail.com,587 counsellor.com,imap.mail.com,995,smtp.mail.com,587 +cryptolab.net,mail.autistici.org,993,smtp.autistici.org,465 cumallover.me,mail.cock.li,993,mail.cock.li,587 cyberservices.com,imap.mail.com,995,smtp.mail.com,587 deliveryman.com,imap.mail.com,995,smtp.mail.com,587 dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 diplomats.com,imap.mail.com,995,smtp.mail.com,587 +disroot.org,disroot.org,993,disroot.org,587 +distruzione.org,mail.autistici.org,993,smtp.autistici.org,465 dr.com,imap.mail.com,995,smtp.mail.com,587 email.arizona.edu,mail.catnet.arizona.edu,993,smtpgate.email.arizona.edu,587 email.com,imap.mail.com,995,smtp.mail.com,587 engineer.com,imap.mail.com,995,smtp.mail.com,587 europe.com,imap.mail.com,995,smtp.mail.com,587 fastmail.com,imap.fastmail.com,993,smtp.fastmail.com,465 +fastmail.fm,imap.fastmail.com,993,smtp.fastmail.com,465 firemail.cc,mail.cock.li,993,mail.cock.li,587 fsmpi.rwth-aachen.de,mail.fsmpi.rwth-aachen.de,993,mail.fsmpi.rwth-aachen.de,465 getbackinthe.kitchen,mail.cock.li,993,mail.cock.li,587 @@ -70,19 +78,29 @@ gmx.net,imap.gmx.net,993,mail.gmx.net,587 gmx.org,imap.gmx.net,993,mail.gmx.net,587 goat.si,mail.cock.li,993,mail.cock.li,587 googlemail.com,imap.googlemail.com,993,smtp.googlemail.com,587 +grrlz.net,mail.autistici.org,993,smtp.autistici.org,465 +hacari.com,mail.autistici.org,993,smtp.autistici.org,465 +hacari.net,mail.autistici.org,993,smtp.autistici.org,465 +hacari.org,mail.autistici.org,993,smtp.autistici.org,465 hitler.rocks,mail.cock.li,993,mail.cock.li,587 horsefucker.org,mail.cock.li,993,mail.cock.li,587 hostgator,gator4171.hostgator.com,993,gator4171.hostgator.com,587 hotmail.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 iname.com,imap.mail.com,995,smtp.mail.com,587 +insiberia.net,mail.autistici.org,993,smtp.autistici.org,465 +insicuri.net,mail.autistici.org,993,smtp.autistici.org,465 +inventati.org,mail.autistici.org,993,smtp.autistici.org,465 +krutt.org,mail.autistici.org,993,smtp.autistici.org,465 linuxmail.org,imap.mail.com,995,smtp.mail.com,587 live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +logorroici.org,mail.autistici.org,993,smtp.autistici.org,465 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,gator4171.hostgator.com,993,gator4171.hostgator.com,587 +lukesmith.xyz,mail.privateemail.com,993,mail.privateemail.com,587 mail.com,imap.mail.com,995,smtp.mail.com,587 -mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,465 +mailbox.org,imap.mailbox.org,993,smtps.mailbox.org,465 memeware.net,mail.cock.li,993,mail.cock.li,587 +mortemale.org,mail.autistici.org,993,smtp.autistici.org,465 msn.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 muny.us,mail.muny.us,993,mail.muny.us,465 myself.com,imap.mail.com,995,smtp.mail.com,587 @@ -90,15 +108,22 @@ narod.ru,imap.yandex.com,993,smtp.yandex.com,465 national.shitposting.agency,mail.cock.li,993,mail.cock.li,587 nigge.rs,mail.cock.li,993,mail.cock.li,587 nuke.africa,mail.cock.li,993,mail.cock.li,587 +onenetbeyond.org,mail.autistici.org,993,smtp.autistici.org,465 outlook.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 +paranoici.org,mail.autistici.org,993,smtp.autistici.org,465 post.com,imap.mail.com,995,smtp.mail.com,587 posteo.de,posteo.de,993,posteo.de,587 +privacyrequired.com,mail.autistici.org,993,smtp.autistici.org,465 rape.lol,mail.cock.li,993,mail.cock.li,587 redchan.it,mail.cock.li,993,mail.cock.li,587 runbox.com,mail.runbox.com,993,mail.runbox.com,587 rwth-aachen.de,mail.rwth-aachen.de,993,mail.rwth-aachen.de,587 sapo.pt,imap.sapo.pt,993,smtp.sapo.pt,587 +stronzi.org,mail.autistici.org,993,smtp.autistici.org,465 +subvertising.org,mail.autistici.org,993,smtp.autistici.org,465 +t-online.de,secureimap.t-online.de,993,securesmtp.t-online.de,465 techie.com,imap.mail.com,995,smtp.mail.com,587 +telenet.be,imap.telenet.be,993,smtp.telenet.be,587 teknik.io,mail.teknik.io,993,mail.teknik.io,587 tfwno.gf,mail.cock.li,993,mail.cock.li,587 tu-harburg.de,mail.tu-harburg.de,993,mail.tu-harburg.de,587 @@ -109,14 +134,16 @@ vt.edu,imap.gmail.com,993,smtp.gmail.com,587 waifu.club,mail.cock.li,993,mail.cock.li,587 wants.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 wants.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 +web.de,imap.web.de,993,smtp.web.de,587 writeme.com,imap.mail.com,995,smtp.mail.com,587 ya.ru,imap.yandex.com,993,smtp.yandex.com,465 yahoo.com,imap.mail.yahoo.com,993,smtp.mail.yahoo.com,587 yandex.by,imap.yandex.com,993,smtp.yandex.com,465 yandex.com,imap.yandex.com,993,smtp.yandex.com,465 -yandex.com,imap.yandex.com,993,smtp.yandex.com,465 yandex.kz,imap.yandex.com,993,smtp.yandex.com,465 yandex.net,imap.yandex.com,993,smtp.yandex.com,465 yandex.ru,imap.yandex.com,993,smtp.yandex.com,465 yandex.ua,imap.yandex.com,993,smtp.yandex.com,465 zoho.com,imap.zoho.com,993,smtp.zoho.com,465 +duke.edu,outlook.office365.com,993,smtp.office365.com,587 + diff --git a/autoconf/msmtprc_header b/autoconf/msmtprc_header new file mode 100644 index 0000000..8040e03 --- /dev/null +++ b/autoconf/msmtprc_header @@ -0,0 +1,6 @@ +defaults +auth on +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +logfile ~/.msmtp.log + diff --git a/autoconf/msmtprc_profile b/autoconf/msmtprc_profile new file mode 100644 index 0000000..0ec99d0 --- /dev/null +++ b/autoconf/msmtprc_profile @@ -0,0 +1,7 @@ + +account $title +host $smtp +port $sport +from $login +user $login +passwordeval "gpg -d --quiet --for-your-eyes-only --no-tty ~/.config/mutt/credentials/$title.gpg | sed -e '$a\'" diff --git a/autoconf/mutt_profile b/autoconf/mutt_profile index 4064ced..a96c93a 100644 --- a/autoconf/mutt_profile +++ b/autoconf/mutt_profile @@ -2,7 +2,6 @@ # muttrc file for account $title set realname = "$realname" set from = "$fulladdr" -set smtp_url = "smtp://$login@$smtp:$sport/" set sendmail = "/usr/bin/msmtp -a $title" set folder = "~/.mail/$title" set header_cache = ~/.config/mutt/accounts/$title/cache/headers @@ -10,10 +9,13 @@ set message_cachedir = ~/.config/mutt/accounts/$title/cache/bodies set certificate_file = ~/.config/mutt/accounts/$title/certificates source "~/.config/mutt/credentials/getmuttpass $title |" +alias me $realname <$fulladdr> + set mbox_type = Maildir set ssl_starttls = yes set ssl_force_tls = yes +bind index,pager gg noop bind index,pager g noop bind index gg first-entry unmailboxes * diff --git a/autoconf/offlineimap_header.macos b/autoconf/offlineimap_header.macos new file mode 100644 index 0000000..86d5678 --- /dev/null +++ b/autoconf/offlineimap_header.macos @@ -0,0 +1,6 @@ +[general] +accounts = +starttls = yes +ssl = true +pythonfile = ~/.config/mutt/credentials/imappwd.py + diff --git a/autoconf/offlineimap_profile b/autoconf/offlineimap_profile index 01b572c..48d466d 100644 --- a/autoconf/offlineimap_profile +++ b/autoconf/offlineimap_profile @@ -1,15 +1,16 @@ -[Account $title] + +[Account $title] localrepository = $title-local remoterepository = $title-remote [Repository $title-remote] +auth_mechanisms = LOGIN type = $type remoteuser = $login -sslcacerfile = /etc/ssl/cets/ca-certificates.crt remotepasseval = mailpasswd("$title") remotehost = $imap -port = $iport +remoteport = $iport folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail'] sslcacertfile = /etc/ssl/certs/ca-certificates.crt diff --git a/autoconf/offlineimap_profile.macos b/autoconf/offlineimap_profile.macos new file mode 100644 index 0000000..e985538 --- /dev/null +++ b/autoconf/offlineimap_profile.macos @@ -0,0 +1,19 @@ +[Account $title] + +localrepository = $title-local +remoterepository = $title-remote + +[Repository $title-remote] +auth_mechanisms = LOGIN +type = $type +remoteuser = $login +sslcacertfile = /usr/local/etc/openssl/cert.pem +remotepasseval = mailpasswd("$title") +remotehost = $imap +remoteport = $iport +folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail'] +sslcacertfile = /usr/local/etc/openssl/cert.pem + +[Repository $title-local] +type = Maildir +localfolders = ~/.mail/$title diff --git a/credentials/getmuttpass b/credentials/getmuttpass index e01c5de..ee25584 100755 --- a/credentials/getmuttpass +++ b/credentials/getmuttpass @@ -1,4 +1,5 @@ #!/bin/bash -pass=$(gpg2 -d -q ~/.config/mutt/credentials/$1.gpg) +pass=$(gpg2 --decrypt --quiet ~/.config/mutt/credentials/$1.gpg) +pass=$(printf '%q' $pass) echo set smtp_pass=\"$pass\" echo set imap_pass=\"$pass\" diff --git a/etc/email.gif b/etc/email.gif Binary files differnew file mode 100644 index 0000000..1ed63cf --- /dev/null +++ b/etc/email.gif diff --git a/etc/htmlopen.sh b/etc/htmlopen.sh new file mode 100755 index 0000000..a0d6c35 --- /dev/null +++ b/etc/htmlopen.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Helps open an HTML file from mutt in a GUI browser without weird side effects. + +file=$(mktemp -u --suffix=.html) + +echo $file +cp "$1" "$file" + +setsid firefox "$file" & diff --git a/etc/mailcap b/etc/mailcap index 45b54f3..519c8a5 100644 --- a/etc/mailcap +++ b/etc/mailcap @@ -1,13 +1,7 @@ -#text/html; qutebrowser %s &; test=test -n "$DISPLAY"; needsterminal; - +text/plain; vim %s ; +text/html; ~/.config/mutt/etc/htmlopen.sh %s ; text/html; w3m -I %{charset} -T text/html; copiousoutput; -#text/html; mv %s %s.html && qutebrowser %s.html > /dev/null; needsterminal; -# -application/pdf; mv %s %s.pdf && i3 exec mupdf %s.pdf > /dev/null; needsterminal; - image/*; ~/.config/mutt/etc/muttimage.sh %s ; copiousoutput - -#application/pdf; pdftotext '%s' -; copiousoutput; description=PDF Document; -#nametemplate=%s.pdf -# -text/plain; vim %s ; +video/*; setsid mpv --quiet %s &; copiousoutput +application/pdf; cp '%s' /tmp/doc.pdf && setsid zathura /tmp/doc.pdf &; copiousoutput; +application/pgp-encrypted; gpg -d '%s'; copiousoutput; diff --git a/etc/mailsync.sh b/etc/mailsync.sh new file mode 100755 index 0000000..5f8d8a7 --- /dev/null +++ b/etc/mailsync.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env sh +# This script will run offlineimap and check +# for new email if there is an internet connection. +# +# If it detects new mail, it uses mpv to play a +# notification sound: notify.opus +# +# I have this run as a cronjob every 5 minutes. + +export DISPLAY=:0.0 + +# Checks for internet connection and set notification script. +# Settings are different for MacOS (Darwin) systems. +if [ "$(uname)" = "Darwin" ] +then + ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit + notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} +else + ping -q -w 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit + notify() { mpv --really-quiet ~/.config/mutt/etc/notify.opus & pgrep -x dunst && notify-send -i ~/.config/mutt/etc/email.gif "$2 new mail(s) in \`$1\` account." ;} +fi + +echo 🔃 > ~/.config/mutt/.dl +pkill -RTMIN+12 i3blocks + +# Run offlineimap. You can feed this script different settings. +offlineimap -o "$@" +rm -f ~/.config/mutt/.dl +pkill -RTMIN+12 i3blocks + +# Check all accounts/mailboxes for new mail. Notify if there is new content. +for account in $(ls ~/.mail) +do + #List unread messages newer than last mailsync and count them + newcount=$(find ~/.mail/"$account"/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l) + if [ "$newcount" -gt "0" ] + then + setsid notify "$account" "$newcount" & + fi +done +notmuch new + +#Create a touch file that indicates the time of the last run of mailsync +touch ~/.config/mutt/etc/mailsynclastrun diff --git a/etc/muttcol b/etc/muttcol index 78704fd..073a8bd 100644 --- a/etc/muttcol +++ b/etc/muttcol @@ -1,58 +1,71 @@ # vim: filetype=neomuttrc -mono bold bold -mono underline underline -mono indicator reverse + +# Default index colors: color index yellow default '.*' color index_author red default '.*' color index_number blue default -color index_subject cyan default '.s' -color index_size green default +color index_subject cyan default '.*' + +# For new mail: +color index brightyellow black "~N" +color index_author brightred black "~N" +color index_subject brightcyan black "~N" + +# Header colors: +color header blue default ".*" +color header brightmagenta default "^(From)" +color header brightcyan default "^(Subject)" +color header brightwhite default "^(CC|BCC)" + +mono bold bold +mono underline underline +mono indicator reverse +mono error bold color normal default default -color body brightred default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ -color body brightblue default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ -color indicator cyan black -color sidebar_highlight black color8 -color sidebar_divider color8 black +color indicator brightblack white +color sidebar_highlight red default +color sidebar_divider brightblack black color sidebar_flagged red black color sidebar_new green black -color normal brightyellow default -color error red default -color tilde black default -color message cyan default -color markers red white -color attachment white default -color search brightmagenta default -color status brightyellow black -color indicator brightblack yellow -mono bold bold -mono underline underline -mono indicator reverse -mono error bold -color hdrdefault brightgreen default -color header brightyellow default "^(From)" -color header blue default "^(Subject)" -color quoted green default -color quoted1 blue default -color quoted2 cyan default -color quoted3 yellow default -color quoted4 red default -color quoted5 brightred default -color signature brightgreen default -color bold black default -color underline black default -color normal default default -color body brightcyan default "[;:][-o][)/(|]" # emoticons -color body brightcyan default "[;:][)(|]" # emoticons -color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\ - |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\ - |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?" -color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? -color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? -color body red default "(BAD signature)" -color body cyan default "(Good signature)" -color body brightblack default "^gpg: Good signature .*" -color body brightyellow default "^gpg: " -color body brightyellow red "^gpg: BAD signature from.*" -mono body bold "^gpg: Good signature" -mono body bold "^gpg: BAD signature from.*" -color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" +color normal brightyellow default +color error red default +color tilde black default +color message cyan default +color markers red white +color attachment white default +color search brightmagenta default +color status brightyellow black +color hdrdefault brightgreen default +color quoted green default +color quoted1 blue default +color quoted2 cyan default +color quoted3 yellow default +color quoted4 red default +color quoted5 brightred default +color signature brightgreen default +color bold black default +color underline black default +color normal default default + +color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses +color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL +color body green default "\`[^\`]*\`" # Green text between ` and ` +color body brightblue default "^# \.*" # Headings as bold blue +color body brightcyan default "^## \.*" # Subheadings as bold cyan +color body brightgreen default "^### \.*" # Subsubheadings as bold green +color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow +color body brightcyan default "[;:][-o][)/(|]" # emoticons +color body brightcyan default "[;:][)(|]" # emoticons +color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\ + |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\ + |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?" +color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? +color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? +color body red default "(BAD signature)" +color body cyan default "(Good signature)" +color body brightblack default "^gpg: Good signature .*" +color body brightyellow default "^gpg: " +color body brightyellow red "^gpg: BAD signature from.*" +mono body bold "^gpg: Good signature" +mono body bold "^gpg: BAD signature from.*" +color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" diff --git a/etc/notify.opus b/etc/notify.opus Binary files differnew file mode 100644 index 0000000..a76ce32 --- /dev/null +++ b/etc/notify.opus diff --git a/etc/view_attachment.sh b/etc/view_attachment.sh new file mode 100755 index 0000000..df8b9a1 --- /dev/null +++ b/etc/view_attachment.sh @@ -0,0 +1,127 @@ +#!/bin/bash +# +# Author: Eric Gebhart +# +# Purpose: To be called by mutt as indicated by .mailcap to handle mail attachments. +# +# Function: Copy the given file to a temporary directory so mutt +# Won't delete it before it is read by the application. +# +# Along the way, discern the file type or use the type +# That is given. +# +# Finally use 'open' or 'open -a' if the third argument is +# given. +# +# +# Arguments: +# +# $1 is the file +# $2 is the type - for those times when file magic isn't enough. +# I frequently get html mail that has no extension +# and file can't figure out what it is. +# +# Set to '-' if you don't want the type to be discerned. +# Many applications can sniff out the type on their own. +# And they do a better job of it too. +# +# Open Office and MS Office for example. +# +# $3 is open with. as in open -a 'open with this .app' foo.xls +# +# Examples: These are typical .mailcap entries which use this program. +# +# Image/JPEG; /Users/vdanen/.mutt/view_attachment %s +# Image/PNG; /Users/vdanen/.mutt/view_attachment %s +# Image/GIF; /Users/vdanen/.mutt/view_attachment %s +# +# Application/PDF; /Users/vdanen/.mutt/view_attachment %s +# +# #This HTML example passes the type because file doesn't always work and +# #there aren't always extensions. +# +# text/html; /Users/vdanen/.mutt/view_attachment %s html +# +# # If your Start OpenOffice.org.app is spelled with a space like this one, <-- +# # then you'll need to precede the space with a \ . I found that too painful +# # and renamed it with an _. +# +# Application/vnd.ms-excel; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app' +# Application/msword; /Users/vdanen/.mutt/view_attachment %s "-" '/Applications/OpenOffice.org1.1.2/Start_OpenOffice.org.app' +# +# +# Debugging: If you have problems set debug to 'yes'. That will cause a debug file +# be written to /tmp/mutt_attach/debug so you can see what is going on. +# +# See Also: The man pages for open, file, basename +# + +# the tmp directory to use. +tmpdir="$HOME/.tmp/mutt_attach" + +# the name of the debug file if debugging is turned on. +debug_file=$tmpdir/debug + +# debug. yes or no. +#debug="no" +debug="yes" + +type=$2 +open_with=$3 + +# make sure the tmpdir exists. +mkdir -p $tmpdir + +# clean it out. Remove this if you want the directory +# to accumulate attachment files. +rm -f $tmpdir/* + +# Mutt puts everything in /tmp by default. +# This gets the basic filename from the full pathname. +filename=`basename $1` + +# get rid of the extenson and save the name for later. +file=`echo $filename | cut -d"." -f1` + +if [ $debug = "yes" ]; then + echo "1:" $1 " 2:" $2 " 3:" $3 > $debug_file + echo "Filename:"$filename >> $debug_file + echo "File:"$file >> $debug_file + echo "===========================" >> $debug_file +fi + +# if the type is empty then try to figure it out. +if [ -z $type ]; then + file $1 + type=`file -bi $1 | cut -d"/" -f2` +fi + +# if the type is '-' then we don't want to mess with type. +# Otherwise we are rebuilding the name. Either from the +# type that was passed in or from the type we discerned. +if [ $type = "-" ]; then + newfile=$filename +else + newfile=$file.$type +fi + +newfile=$tmpdir/$newfile + +# Copy the file to our new spot so mutt can't delete it +# before the app has a chance to view it. +cp $1 $newfile + +if [ $debug = "yes" ]; then + echo "File:" $file "TYPE:" $type >> $debug_file + echo "Newfile:" $newfile >> $debug_file + echo "Open With:" $open_with >> $debug_file +fi + +# If there's no 'open with' then we can let preview do it's thing. +# Otherwise we've been told what to use. So do an open -a. + +if [ -z $open_with ]; then + open $newfile +else + open -a "$open_with" $newfile +fi diff --git a/mutt-wizard.sh b/mutt-wizard.sh index 4946775..a7376b1 100755 --- a/mutt-wizard.sh +++ b/mutt-wizard.sh @@ -1,15 +1,43 @@ -#!/bin/bash +#!/usr/bin/env bash -muttdir="$HOME/.config/mutt/" +[ "$(uname)" == "Darwin" ] && os=".macos" + +muttdir="$HOME/.config/mutt" +namere="^[a-z_][a-z0-9_-]*$" +emailre=".+@.+\..+" + +createMailboxes() { \ + tmpdir=$(mktemp -d) + offlineimap --info -a $1 2&> "$tmpdir"/log + sed -n '/^Folderlist/,/^Folderlist/p' "$tmpdir"/log | + grep "^ " | sed -e "s/\//./g;s/(.*//g;s/^ //g" > "$tmpdir"/lognew + while read box; do mkdir -p "$HOME/.mail/$1/$box"; done <"$tmpdir"/lognew ;} + +testSync() { (crontab -l | grep mailsync.sh && removeSync) || addSync ;} + +addSync() { min=$(dialog --inputbox "How many minutes should be between mail syncs?" 8 60 3>&1 1>&2 2>&3 3>&-) + (crontab -l; echo "*/$min * * * * eval \"export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME -x i3)/environ)\"; "$muttdir"/etc/mailsync.sh") | crontab - && + dialog --msgbox "Cronjob successfully added. Remember you may need to restart or tell systemd/etc. to start your cron manager for this to take effect." 7 60 ;} + +removeSync() { ((crontab -l | sed -e '/mailsync.sh/d') | crontab - >/dev/null) && dialog --msgbox "Cronjob successfully removed. To reactivate, select this option again." 6 60 ;} changePassword() { \ gpgemail=$( dialog --title "Luke's mutt/offlineIMAP password wizard" --inputbox "Insert the email address with which you originally created your GPG key pair. This is NOT necessarily the email you want to configure." 10 60 3>&1 1>&2 2>&3 3>&- ) + while ! [[ "${gpgemail}" =~ ${emailre} ]]; do + gpgemail=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "That's not a valid email address. Please input the entire address." 10 60 3>&1 1>&2 2>&3 3>&1) + done dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the new password for the \"$1\" account." 10 60 2> /tmp/$1 gpg2 -r $gpgemail --encrypt /tmp/$1 || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg." 7 60 && break) shred -u /tmp/$1 - mv /tmp/$1.gpg ~/.config/mutt/credentials/ ;} + mv /tmp/$1.gpg "$muttdir"/credentials/ + dialog --title "Finalizing your account." --infobox "The account \"$title\"'s password has been changed. Now attempting to configure mail directories... -chooseDetect() { for x in $(cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'); do detectMailboxes $x; done && detectSuccess ;} + This may take several seconds..." 10 70 + createMailboxes $title || (clear && exit) + detectMailboxes $title + dialog --title "Password changed." --msgbox "Your "$fulladdr" password has been changed. To start the download of your mail, you can manually run \`offlineimap -a $title\` in a terminal. The first sync may take some time depending on the amount of your mail." 8 60 ;} + +chooseDetect() { for x in $(grep "^accounts =" ~/.offlineimaprc | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;'); do detectMailboxes $x; done && detectSuccess ;} detectWarning() { \ dialog --title "Mailbox detect requirement" --yesno "In order for the mailbox detection system to work, you must have @@ -33,7 +61,7 @@ These shortcuts will only work if your email system does have that particular fo formatShortcut() { \ while read data; do - echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"Go to $2.\"" >> "$muttdir"accounts/$3.muttrc + echo "macro index,pager g$1 \"<change-folder>$data<enter>\" \"Go to $2.\"" >> "$muttdir"/accounts/$3.muttrc done ;} gen_delim() { \ @@ -48,27 +76,29 @@ detectMailboxes() { \ find ~/.mail/$1 -maxdepth 1 -mindepth 1 -type d | sed -e "s/.*\///g;s/^/=/g" > /tmp/$1_boxes sidebar_width=$(sed -n -e '/^set sidebar_width/p' "$muttdir"/muttrc | awk -F'=' '{print $2}') delim=$(gen_delim $sidebar_width) - oneline=$(cat /tmp/$1_boxes | sed -e "s/^\|$/\"/g" | tr "\n" " ") + oneline=$(sed -e "s/^\|$/\"/g" /tmp/$1_boxes | tr "\n" " ") oneline="=$1 $delim $oneline" - sed -i "/^mailboxes\|^set spoolfile\|^set record\|^set postponed/d" "$muttdir"accounts/$1.muttrc - echo mailboxes $oneline >> "$muttdir"accounts/$1.muttrc - sed -i "/^macro index,pager g/d" "$muttdir"accounts/$1.muttrc - grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call" | sort -n | sed 1q | formatShortcut i inbox $1 + sed -i "/^mailboxes\|^set record\|^set postponed\|^set trash\|^set spoolfile/d" "$muttdir"/accounts/$1.muttrc + echo mailboxes $oneline >> "$muttdir"/accounts/$1.muttrc + sed -i "/^macro index,pager g/d" "$muttdir"/accounts/$1.muttrc + grep -i /tmp/$1_boxes -e inbox | sed 1q | formatShortcut i inbox $1 grep -i /tmp/$1_boxes -e sent | sed 1q | formatShortcut s sent $1 grep -i /tmp/$1_boxes -e draft | sed 1q | formatShortcut d drafts $1 grep -i /tmp/$1_boxes -e trash | sed 1q | formatShortcut t trash $1 grep -i /tmp/$1_boxes -e spam | sed 1q | formatShortcut S spam $1 grep -i /tmp/$1_boxes -e archive | sed 1q | formatShortcut a archive $1 - spoolfile=$(grep -vi /tmp/$1_boxes -e "trash\|drafts\|sent\|trash\|spam\|junk\|archive\|chat\|old\|new\|gmail\|sms\|call" | sort -n | sed 1q | sed -e 's/=/+/g') + spoolfile=$(grep -i /tmp/$1_boxes -e inbox | sed -e 's/=/+/g' | sed 1q) record=$(grep -i /tmp/$1_boxes -e sent | sed -e 's/=/+/g' | sed 1q) postponed=$(grep -i /tmp/$1_boxes -e draft | sed -e 's/=/+/g' | sed 1q) - echo "set spoolfile = \"$spoolfile\"" >> "$muttdir"accounts/$1.muttrc - echo "set record = \"$record\"" >> "$muttdir"accounts/$1.muttrc - echo "set postponed = \"$postponed\"" >> "$muttdir"accounts/$1.muttrc ;} + trash=$(grep -i /tmp/$1_boxes -e trash | sed -e 's/=/+/g' | sed 1q) + echo "set spoolfile = \"$spoolfile\"" >> "$muttdir"/accounts/$1.muttrc + echo "set record = \"$record\"" >> "$muttdir"/accounts/$1.muttrc + echo "set postponed = \"$postponed\"" >> "$muttdir"/accounts/$1.muttrc + echo "set trash = \"$trash\"" >> "$muttdir"/accounts/$1.muttrc ;} # Get all accounts in ~/.offlineimaprc and load into variable `accounts`. getAccounts() { \ - cat ~/.offlineimaprc | grep "^accounts =" | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;' | nl --number-format=ln > /tmp/numbered + grep "^accounts =" ~/.offlineimaprc | sed -e 's/accounts =\( \)//g;s/\(,\) /\n/g;' | nl --number-format=ln > /tmp/numbered accounts=() while read n s ; do accounts+=($n "$s" off) @@ -94,10 +124,10 @@ removeAccount() { sed -ie " s/=$1\(,\|$\)/=/g s/,$//g " ~/.offlineimaprc - rm "$muttdir"accounts/$1.muttrc - rm "$muttdir"credentials/$1.gpg - rm -rf "$muttdir"accounts/$1 - sed -i '/$1.muttrc/d' "$muttdir"personal.muttrc ;} + rm "$muttdir"/accounts/$1.muttrc + rm "$muttdir"/credentials/$1.gpg + rm -rf "$muttdir"/accounts/$1 + sed -i "/$1.muttrc/d" "$muttdir"/personal.muttrc ;} manual() { \ imap=$( dialog --inputbox "Insert the IMAP server for your email provider (excluding the port number)" 10 60 3>&1 1>&2 2>&3 3>&- ) @@ -107,8 +137,11 @@ manual() { \ addloop() { fulladdr=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Insert the full email address for the account you want to configure." 10 60 3>&1 1>&2 2>&3 3>&- ) +while ! [[ "${fulladdr}" =~ ${emailre} ]]; do + fulladdr=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "That's not a valid email address. Please input the entire address." 10 60 3>&1 1>&2 2>&3 3>&1) +done # Check to see if domain is in domain list -serverinfo=$(cat "$muttdir"autoconf/domains.csv | grep -w ^${fulladdr##*@}) +serverinfo=$(grep -w ^${fulladdr##*@} "$muttdir"/autoconf/domains.csv) if [ -z "$serverinfo" ]; then manual @@ -119,8 +152,11 @@ $serverinfo EOF fi realname=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter the full name you'd like to be identified by on this email account." 10 60 3>&1 1>&2 2>&3 3>&- ) -title=$( dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Give a short, one-word name for this email account that will differentiate it from other email accounts." 10 60 3>&1 1>&2 2>&3 3>&- ) -login=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Enter your login for the \"$title\" account.\n(If left empty, the full email address will be used instead.)" 10 60 3>&1 1>&2 2>&3 3>&- ) +title=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Give a short, one-word name for this email account that will differentiate it from other email accounts." 10 60 3>&1 1>&2 2>&3 3>&1) || exit +while ! [[ "${title}" =~ ${namere} ]]; do + title=$(dialog --no-cancel --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "Account title not valid. Give a username beginning with a letter, with only lowercase letters, - or _." 10 60 3>&1 1>&2 2>&3 3>&1) +done +login=$(dialog --title "Luke's mutt/offlineIMAP autoconfig" --inputbox "If you have a username for the \"$title\" account which is different from your email address, enter it here. Otherwise leave this prompt blank." 10 60 3>&1 1>&2 2>&3 3>&- ) # Sets the repo type and other variables for the sed regex. if [[ "$service" == "gmail.com" ]]; then @@ -147,7 +183,7 @@ replacement=" s/\$login/$login/g; /$delet/d" # Gets the first unused shortcut number in the muttrc and puts it in $idnum. -cat "$muttdir"personal.muttrc | grep i[0-9] | awk '{print $3}' | sed -e 's/i//g' > /tmp/mutt_used +grep i[0-9] "$muttdir"/personal.muttrx | awk '{print $3}' | sed -e 's/i//g' > /tmp/mutt_used echo -e "1\n2\n3\n4\n5\n6\n7\n8\n9" > /tmp/mutt_all_possible idnum=$(diff /tmp/mutt_all_possible /tmp/mutt_used | sed -n 2p | awk '{print $2}') addAccount \ @@ -158,38 +194,42 @@ addAccount() { dialog --title "Luke's mutt/offlineIMAP password wizard" --passwordbox "Enter the password for the \"$title\" account." 10 60 2> /tmp/$title gpg2 -r $gpgemail --encrypt /tmp/$title || (dialog --title "GPG decryption failed." --msgbox "GPG decryption failed. This is either because you do not have a GPG key pair or because your distro uses GPG1 and you thus need to symlink /usr/bin/gpg2 to /usr/bin/gpg." 7 60 && break) shred -u /tmp/$title - mv /tmp/$title.gpg ~/.config/mutt/credentials/ + mv /tmp/$title.gpg "$muttdir"/credentials/ # Adding directory structure for cache. - mkdir -p "$muttdir"accounts/$title/cache/bodies + mkdir -p "$muttdir"/accounts/$title/cache/bodies # Creating the offlineimaprc if it doesn't exist already. - if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"autoconf/offlineimap_header ~/.offlineimaprc; fi - cat "$muttdir"autoconf/offlineimap_profile | sed -e "$replacement" >> ~/.offlineimaprc + if [ ! -f ~/.offlineimaprc ]; then cp "$muttdir"/autoconf/offlineimap_header"$os" ~/.offlineimaprc; fi + sed -e "$replacement" "$muttdir"/autoconf/offlineimap_profile"$os" >> ~/.offlineimaprc mkdir -p ~/.mail/$title + # Creating msmtprc if it doesn't exist already. + if [ ! -f ~/.msmtprc ]; then cp "$muttdir"/autoconf/msmtprc_header ~/.msmtprc; fi + sed -e "$replacement" "$muttdir"/autoconf/msmtprc_profile >> ~/.msmtprc + # Add the mutt profile. - cat "$muttdir"autoconf/mutt_profile | sed -e "$replacement" > "$muttdir"accounts/$title.muttrc + sed -e "$replacement" "$muttdir"/autoconf/mutt_profile > "$muttdir"/accounts/$title.muttrc # Add a numbered shortcut in the muttrc - echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source "$muttdir"accounts/$title.muttrc<enter><change-folder>!<enter>'" >> "$muttdir"personal.muttrc + echo "macro index,pager i$idnum '<sync-mailbox><enter-command>source "$muttdir"/accounts/$title.muttrc<enter><change-folder>!<enter>;<check-stats>'" >> "$muttdir"/personal.muttrc # Add to offlineimaprc sync list. - sed -i "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =$/accounts = $title/g" ~/.offlineimaprc + sed -i.bu "s/^accounts =.*[a-zA-Z]$/&, $title/g;s/^accounts =\s*$/accounts = $title/g" ~/.offlineimaprc && rm ~/.offlineimaprc.bu # Makes account default if there is no default account. - grep "$muttdir"personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \ - echo "source ${muttdir}accounts/$title.muttrc" >> "$muttdir"personal.muttrc - - dialog --title "Finalizing your account." --msgbox "The account \"$title\" has been added. Now to finalize installation, do the following: + grep "$muttdir"/personal.muttrc -e "^source .*accounts.*" >/dev/null && echo there || \ + echo "source ${muttdir}/accounts/$title.muttrc" >> "$muttdir"/personal.muttrc - 1) Run offlineimap to start the sync. This will start your mail sync. - 2) After or while running offlineimap, choose the \"autodetect mailboxes\" option, which will finalize your config files based on the directory structure of the downloaded mailbox. + dialog --title "Finalizing your account." --infobox "The account \"$title\" has been added. Now attempting to configure mail directories... - After that, you will be able to open neomutt to your email account." 13 80 ;} + This may take several seconds..." 10 70 + createMailboxes $title || (clear && exit) + detectMailboxes $title + dialog --title "Account added." --msgbox "Your "$fulladdr" account has been added. To start the download of your mail, you can manually run \`offlineimap -a $title\` in a terminal. The first sync may take some time depending on the amount of your mail." 8 60 ;} # This is run when a user chooses to add an account. chooseAdd() { \ - mkdir -p "$muttdir"credentials/ "$muttdir"accounts/ + mkdir -p "$muttdir"/credentials/ "$muttdir"/accounts/ gpgemail=$( dialog --title "Luke's mutt/offlineIMAP password wizard" --inputbox "Insert the email address with which you originally created your GPG key pair. This is NOT necessarily the email you want to configure." 10 60 3>&1 1>&2 2>&3 3>&- ) addloop while : ; @@ -200,20 +240,21 @@ chooseAdd() { \ wipe () { rm $HOME/.offlineimaprc rm -rf "$muttdir"/accounts - rm -f "$muttdir"credentials/*gpg - rm "$muttdir"personal.muttrc ;} + rm -f "$muttdir"/credentials/*gpg + rm "$muttdir"/personal.muttrc ;} while : ; do choice=$(dialog --title "Luke's mutt/offlineIMAP wizard" --nocancel \ - --menu "What would you like to do?" 14 45 7 \ + --menu "What would you like to do?" 15 45 8 \ 0 "List all email accounts configured." \ 1 "Add an email account." \ - 2 "Auto-detect mailboxes for an account." \ - 3 "Change an account's password." \ - 4 "Remove an email account." \ - 5 "Remove all email accounts." \ - 6 "Exit this wizard." \ + 2 "Enable/disable autosync." \ + 3 "Redetect mailboxes." \ + 4 "Change an account's password." \ + 5 "Remove an email account." \ + 6 "Remove all email accounts." \ + 7 "Exit this wizard." \ 3>&1 1>&2 2>&3 3>&1 ) case $choice in @@ -221,10 +262,12 @@ case $choice in $(grep ~/.offlineimaprc -e "^accounts =" | sed 's/accounts =//g') " 6 60;; 1) chooseAdd;; -2) detectWarning && chooseDetect ;; -3) inventory && for i in $userchoices; do changePassword $i ; done;; -4) inventory && for i in $userchoices; do removeAccount $i ; done;; -5) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;; -6) clear && break ;; +2) testSync;; +3) detectWarning && chooseDetect;; +4) inventory && for i in $userchoices; do changePassword $i ; done;; +5) inventory && for i in $userchoices; do removeAccount $i ; done;; +6) (dialog --defaultno --title "Wipe all custom neomutt/offlineIMAP settings?" --yesno "Would you like to wipe all of the mutt/offlineIMAP settings generated by the system?" 6 60 && wipe) ;; +7) clear && break ;; +*) echo "Unable to read response from dialog. Exiting." >&2; exit 2 esac done @@ -5,34 +5,67 @@ bind index,pager g noop bind index \Cf noop source etc/muttcol source etc/aliases +source personal.muttrc set sleep_time = 0 set sort = 'reverse-date' -set editor = vim +set editor = $EDITOR #set copy = no set timeout = "5" set mail_check = "10" set mailcap_path = ~/.config/mutt/etc/mailcap -set date_format="%m/%d %I:%M" -set index_format="%2C %Z %D %-15.15F %s (%-4.4c)" +set date_format="%y/%m/%d %I:%M" +set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" set markers = no set mark_old = no set mime_forward = yes +set smtp_authenticators = 'gssapi:login' +set wait_key = no auto_view text/html -auto_view application/pdf +auto_view application/pgp-encrypted alternative_order text/plain text/enriched text/html +set rfc2047_parameters = yes # General remappings bind editor <space> noop bind index G last-entry bind index gg first-entry +bind pager j next-line +bind pager k previous-line +bind pager gg top +bind pager G bottom bind index d half-down bind index u half-up bind index D delete-message bind index U undelete-message bind index F search bind index,pager R group-reply -macro index,pager S '<sync-mailbox> -macro index,pager \Cu |urlview\n +bind index,pager \031 previous-undeleted # Mouse wheel +bind index,pager \005 next-undeleted # Mouse wheel +macro index,pager S <sync-mailbox> +macro index,pager \Cu |urlscan\n +macro index,pager ,, |urlscan\n + +# View attachments properly. +bind attach <return> view-mailcap +set fast_reply # skip to compose when replying +set fcc_attach # save attachments with the body +unset mime_forward # forward attachments as part of body +set forward_format = "Fwd: %s" # format of subject when forwarding +set forward_decode # decode when forwarding +set forward_quote # include message in forwards +set reverse_name # reply as whomever it was to +set include # include message in replies + +#Ctrl-R to mark all as read +macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" + +#sync email +macro index O "<shell-escape>$HOME/.config/mutt/etc/mailsync.sh<enter>" "run offlineimap to sync all mail" +macro index o "<shell-escape>$HOME/.config/mutt/etc/mailsync.sh -qf INBOX<enter>" "run offlineimap to sync inbox" + +#copy/move dialogs +macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox" +macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox" # Notmuch searching macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'notmuch query: ' x; echo \$x >~/.cache/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat ~/.cache/mutt_terms) | head -n 600 | perl -le '@a=<>;chomp@a;s/\^id:// for@a;$,=\"|\";print@a'\`\"<enter>" "show only messages matching a notmuch pattern" @@ -48,10 +81,6 @@ set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' bind index,pager \Ck sidebar-prev bind index,pager \Cj sidebar-next bind index,pager \Co sidebar-open -bind index,pager <F3> sidebar-page-up -bind index,pager <F4> sidebar-page-down bind index,pager \Cp sidebar-prev-new bind index,pager \Cn sidebar-next-new bind index,pager B sidebar-toggle-visible - -source personal.muttrc |