Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

First commit

  • Loading branch information...
commit f7a1af674174530ba4c8aa31ec77c81deb4ad921 0 parents
@ershad authored
17 Equifax_Secure_CA.pem
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAomgAwIBAgIENd70zzANBgkqhkiG9w0BAQUFADBOMQswCQYDVQQGEwJVUzEQMA4GA1UE
+ChMHRXF1aWZheDEtMCsGA1UECxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5
+MB4XDTk4MDgyMjE2NDE1MVoXDTE4MDgyMjE2NDE1MVowTjELMAkGA1UEBhMCVVMxEDAOBgNVBAoT
+B0VxdWlmYXgxLTArBgNVBAsTJEVxdWlmYXggU2VjdXJlIENlcnRpZmljYXRlIEF1dGhvcml0eTCB
+nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwV2xWGcIYu6gmi0fCG2RFGiYCh7+2gRvE4RiIcPR
+fM6fBeC4AfBONOziipUEZKzxa1NfBbPLZ4C/QgKO/t0BCezhABRP/PvwDN1Dulsr4R+AcJkVV5MW
+8Q+XarfCaCMczE1ZMKxRHjuvK9buY0V7xdlfUNLjUA86iOe/FP3gx7kCAwEAAaOCAQkwggEFMHAG
+A1UdHwRpMGcwZaBjoGGkXzBdMQswCQYDVQQGEwJVUzEQMA4GA1UEChMHRXF1aWZheDEtMCsGA1UE
+CxMkRXF1aWZheCBTZWN1cmUgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MQ0wCwYDVQQDEwRDUkwxMBoG
+A1UdEAQTMBGBDzIwMTgwODIyMTY0MTUxWjALBgNVHQ8EBAMCAQYwHwYDVR0jBBgwFoAUSOZo+SvS
+spXXR9gjIBBPM5iQn9QwHQYDVR0OBBYEFEjmaPkr0rKV10fYIyAQTzOYkJ/UMAwGA1UdEwQFMAMB
+Af8wGgYJKoZIhvZ9B0EABA0wCxsFVjM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Udib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMRuHM/
+qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQQFAAOBgQAm
+SCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUIhfzJATj/Tb7yFkJD57taRvvBxhEf
+8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JMpAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7t
+UCemDaYj+bvLpgcUQg==
+-----END CERTIFICATE-----
185 muttgconf.cpp
@@ -0,0 +1,185 @@
+/*
+ * muttgconf.cpp
+ *
+ * Copyright (C) 2010 Ershad K <ershad92@gmail.com>
+ *
+ * This 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 ; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ *
+ * See http://ershadk.wordpress.com for usage.
+ */
+
+#include <iostream>
+#include <fstream>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <string>
+
+using namespace std;
+
+class User
+{
+ string GID; // Gmail ID eg:- john.example@gmail.com
+ string GUsername; // Gmail login Username eg:- john.example
+ string Password; // Gmail Password
+ string Username; // System Username
+
+public:
+
+ void Header()
+ {
+ cout << "\n Welcome to MuttGconf V 1.0 www.ershadk.wordpress.com";
+ cout << "\n -------------------------------------------------------------";
+ cout << "\n This program is based on -"
+ << "\n http://www.andrews-corner.org/mutt.html";
+ cout << "\n -------------------------------------------------------------\n";
+ }
+
+ void GetDetails()
+ {
+ int i;
+
+ cout << "\n Enter your Gmail ID [with @gmail.com] : ";
+ getline (cin, GID);
+
+ cout << "\n Enter Password [CAUTION: Password will be showed as you type] : ";
+ getline (cin, Password);
+
+ // Retrieving Gmail Login Username from Gmail ID
+ i = GID.find_first_of ('@');
+ GUsername = GID.substr (0, i);
+
+ cout << "\n Enter Username of the system : ";
+ getline (cin,Username);
+
+ cout << "\n " << GUsername << "\n";
+
+ }
+
+ void SetCertificates();
+ void WriteFetchmailConf();
+ void SetProcmail();
+ void WriteSendmailConf();
+ void Writemuttrc();
+};
+
+void User::Writemuttrc()
+{
+ string muttrcPath;
+ muttrcPath = "/home/" + Username + "/.muttrc";
+ string shellcmd;
+ shellcmd = "cp muttrc " + muttrcPath;
+ string sed1;
+ string sed2;
+
+ sed1 = "sed -i 's/Username123/" + Username + "/g' " + muttrcPath;
+ sed2 = "sed -i 's/GID123/" + GID + "/g' " + muttrcPath;
+
+ system(shellcmd.c_str());
+ system(sed1.c_str());
+ system(sed2.c_str());
+}
+
+void User::WriteSendmailConf()
+{
+ string conf;
+ string msmtprcPath;
+
+ msmtprcPath = "/home/" + Username + "/.msmtprc";
+
+ ofstream msmtprcfile (msmtprcPath.c_str());
+
+ conf = "account default\nhost smtp.gmail.com\nport 587\nfrom " + GID;
+ conf = conf + "\ntls on\ntls_starttls on";
+ conf = conf + "\ntls_trust_file /home/"+ Username + "/mail/certs/Thawte_Premium_Server_CA.pem";
+ conf = conf + "\n# tls_trust_file /home/" + Username +"/mail/certs/Equifax_Secure_CA.pem\nauth on";
+ conf = conf + "\nuser " + GUsername + "\npassword " + Password + "\nlogfile ~/.msmtp.log";
+
+ msmtprcfile << conf;
+ system("chmod 600 ~/.msmtprc");
+}
+
+
+void User:: SetProcmail()
+{
+ string conf;
+ string Bashpath;
+ conf = "\nMAIL=/var/spool/mail/" + Username + " && export MAIL";
+
+ Bashpath = "/home/" + Username + "/.bashrc";
+
+ ofstream bashfile (Bashpath.c_str(), ios::app );
+ bashfile << conf;
+
+ string Pconf;
+ string Ppath;
+
+ Ppath = "/home/" + Username + "/.procmailrc";
+
+ Pconf = "PATH=/bin:/usr/bin:/usr/local/bin\nVERBOSE=off\nDEFAULT=/var/spool/mail/" + Username;
+ Pconf = Pconf + "\nMAILDIR=$HOME/mail\nLOGFILE=$HOME/.procmaillog\n# Recipes below this comment:\n\n:0:\n* ^TOmutt-user\n\nmutt";
+
+ ofstream procmailrc (Ppath.c_str());
+ procmailrc << Pconf;
+
+}
+
+void User::WriteFetchmailConf()
+{
+ string Fetchmailpath;
+ Fetchmailpath = "/home/" + Username + "/.fetchmailrc" ;
+
+ ofstream fetchmailrc (Fetchmailpath.c_str());
+ fetchmailrc << "poll pop.gmail.com\n"
+ << "with proto POP3\n" << "user '" << GID <<"' \n"
+ << "there with password '" << Password << "' \n"
+ << "is '" << Username << "' here \n"
+ << "mda " << (char) 34 << "/usr/bin/procmail -d %T" << (char) 34 << "\n"
+ << "options\n"
+ << "no keep\n"
+ << "ssl\n"
+ << "sslcertck";
+
+ system ("chmod 600 ~/.fetchmailrc");
+
+}
+void User::SetCertificates()
+{
+ system ("mkdir -pv $HOME/mail/certs");
+ system ("cp Equifax_Secure_CA.pem $HOME/mail/certs/Equifax_Secure_CA.pem");
+ system ("cp Thawte_Premium_Server_CA.pem $HOME/mail/certs/Thawte_Premium_Server_CA.pem");
+ system ("c_rehash $HOME/mail/certs/");
+}
+
+int main()
+{
+ User ob;
+ ob.Header();
+ ob.GetDetails();
+
+ cout << "\n .............................................................\n";
+ ob.SetCertificates();
+ ob.WriteFetchmailConf();
+ ob.SetProcmail();
+ ob.WriteSendmailConf();
+ ob.Writemuttrc();
+ cout << "\n .............................................................\n";
+
+ cout << "\n Done :) Now start mutt, press '!' and type 'fetchmail -v' "
+ << "\n without quotes to get mails through POP3 and read it in "
+ << "\n mutt. Thank you for using MuttGconf. Nice day!";
+}
+
74 muttrc
@@ -0,0 +1,74 @@
+#======================================================#
+# Boring details
+set realname = "Username123"
+set from = "GID123"
+set use_from = yes
+set envelope_from ="yes"
+
+# Use a signature
+set signature="~/.signature"
+
+# Use msmtp rather than sendmail. Check that
+# the path is correct for your system:
+set sendmail="/usr/bin/msmtp"
+
+# If not set in ~/.bashrc:
+set spoolfile = /var/spool/mail/Username123
+
+#======================================================#
+# Folders
+set folder="$HOME/mail" # Local mailboxes stored here
+set record="+sent" # Where to store sent messages
+set postponed="+postponed" # Where to store draft messages
+set mbox_type=mbox # Mailbox type
+set move=no # Don't move mail from spool
+
+#======================================================#
+# Watch these mailboxes for new mail, useful only if
+# Procmail or Maildrop is used to sort mail.
+mailboxes ! +slrn +fetchmail +mutt
+set sort_browser=alpha # Sort mailboxes by alpha(bet)
+
+#======================================================#
+# What to show and order of headers
+ignore *
+unignore Date: From: User-Agent: X-Mailer X-Operating-System To: \
+ Cc: Reply-To: Subject: Mail-Followup-To:
+hdr_order Date: From: User-Agent: X-Mailer X-Operating-System To: \
+ Cc: Reply-To: Subject: Mail-Followup-To:
+
+#======================================================#
+# which editor do you want to use?
+# vim of course!
+set editor="vim -c 'set tw=70 et' '+/^$' "
+set edit_headers=yes # See the headers when editing
+
+#======================================================#
+# Aliases
+
+set alias_file = ~/mail/mutt_aliases # In their own file
+source ~/mail/mutt_aliases # Source them
+set sort_alias=alias # Sort alphabetically
+
+#======================================================#
+# Colours: defaults are a little bleak so experiment!
+
+source ~/mutt/mutt_colors # In their own file
+
+#======================================================#
+# Lists: An example using the mutt-users list:
+
+lists mutt-users
+subscribe mutt-users
+set followup_to=yes # Sets 'Mail-Followup-To' header
+set honor_followup_to=yes
+fcc-hook mutt-user +mutt # See your own posts using fcc
+
+#======================================================#
+# Odds and ends
+
+set markers # mark wrapped lines of text in the pager with a +
+set smart_wrap # Don't wrap mid-word
+set pager_context=5 # Retain 5 lines of previous page when scrolling.
+set status_on_top # Status bar on top.
+push <show-version> # Shows mutt version at startup
Please sign in to comment.
Something went wrong with that request. Please try again.