Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fb2d0ea
Showing
18 changed files
with
1,188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
############################################ | ||
|
||
MassMailer v1.5 | ||
|
||
############################################ | ||
|
||
@author : harshadura | ||
@email : harshadura@gmail.com | ||
|
||
--------------------------- | ||
Required Software | ||
--------------------------- | ||
|
||
(01) Java 1.6 | ||
(02) Apache Maven 2.2.1 | ||
(03) Mysql Server 5.1 | ||
|
||
----------------------------------------------------- | ||
Configure Massmailer Propertiesfile before Usage. | ||
----------------------------------------------------- | ||
|
||
> Copying the "bulk.properties" file into required Destination. | ||
> for Windows : Copy "bulk.properties" file into C:\bulk.properties | ||
> for Linux : Copy "bulk.properties" file into /home/bulk.properties | ||
|
||
> Configure the properties in "bulk.properties" file as Necessary | ||
|
||
Sample : | ||
db.name=massmailer | ||
db.user=root | ||
db.pass=PASS | ||
|
||
smtp.host=smtp.gmail.com | ||
smtp.port=587 | ||
smtp.user=TEST@gmail.com | ||
smtp.pass=PASS | ||
|
||
--------------------------- | ||
Running MassMailer | ||
--------------------------- | ||
|
||
> start mysql server | ||
|
||
> source the database schema. (dbqueries.sql) | ||
mysql> source <path>/dbqueries.sql | ||
|
||
> Using command line, goto the Inside of MassMailer project folder. | ||
|
||
> type | ||
mvn clean install | ||
|
||
> MassMailer.Jar can be found in <project>/target directory. | ||
|
||
--------------------------- | ||
Notes - Usage | ||
--------------------------- | ||
|
||
> MassMailer uses MySql Tables to Recognize the Email Categories. | ||
> So Insert All the same grouped Emails into one MySql Table. | ||
> After that when using the MassMailer give the Relevant "TABLE NAME" for the "Bulk" Field. | ||
|
||
------------------------------------------- | ||
Troubleshoot | ||
------------------------------------------- | ||
If an error occured like this "Java.lang.ClassNotFoundException:" | ||
Copy the All JARs files into below folders and Restart the Application. | ||
|
||
Linux | ||
----- | ||
\jre\lib | ||
\jre\lib\ext | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
db.name=massmailer | ||
db.user=root | ||
db.pass=PASS | ||
|
||
smtp.host=smtp.gmail.com | ||
smtp.port=587 | ||
smtp.user=TEST@gmail.com | ||
smtp.pass=PASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- -------------------------------------------------------- | ||
-- ----- MASS-MAILER DB DUMP ------------------------------ | ||
-- -------------------------------------------------------- | ||
|
||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; | ||
|
||
-- | ||
-- Database: `massmailer` | ||
-- | ||
CREATE DATABASE `massmailer` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; | ||
USE `massmailer`; | ||
|
||
-- Email Addresses Table of Group one Set. | ||
|
||
CREATE TABLE Group1 | ||
( | ||
tuple int NOT NULL AUTO_INCREMENT, | ||
email varchar(100), | ||
PRIMARY KEY (tuple) | ||
); | ||
|
||
insert into Group1 (tuple, email) values (1, "harshato@gmail.com"); | ||
insert into Group1 (tuple, email) values (2, "harshadura@gmail.com"); | ||
insert into Group1 (tuple, email) values (3, "test1@gmail.com"); | ||
insert into Group1 (tuple, email) values (4, "test2@gmail.com"); | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<actions> | ||
<action> | ||
<actionName>run</actionName> | ||
<goals> | ||
<goal>process-classes</goal> | ||
<goal>org.codehaus.mojo:exec-maven-plugin:1.1.1:exec</goal> | ||
</goals> | ||
<properties> | ||
<exec.classpathScope>runtime</exec.classpathScope> | ||
<exec.args>-classpath %classpath com.dura.mymailapp.ui.Interface</exec.args> | ||
<exec.executable>java</exec.executable> | ||
</properties> | ||
</action> | ||
</actions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.universl</groupId> | ||
<artifactId>MassMailer</artifactId> | ||
<version>1.5</version> | ||
<packaging>jar</packaging> | ||
<name>MassMailerV1.5</name> | ||
<url>http://maven.apache.org</url> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass>com.universl.massmailer.ui.Interface</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.6</source> | ||
<target>1.6</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<repositories> | ||
<repository> | ||
<id>unknown-jars-temp-repo</id> | ||
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name> | ||
<url>file:${project.basedir}/lib</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>javax.activation</groupId> | ||
<artifactId>activation</artifactId> | ||
<version>1.1.1</version> | ||
<scope>system</scope> | ||
<systemPath>${basedir}/lib/activation-1.1.1.jar</systemPath> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.mail</groupId> | ||
<artifactId>mail</artifactId> | ||
<version>1.4.4</version> | ||
<scope>system</scope> | ||
<systemPath>${basedir}/lib/mail-1.4.4.jar</systemPath> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>5.0.7</version> | ||
<scope>system</scope> | ||
<systemPath>${basedir}/lib/mysql-connector-java-5.0.7-bin.jar</systemPath> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.14</version> | ||
<scope>system</scope> | ||
<systemPath>${basedir}/lib/log4j-1.2.14.jar</systemPath> | ||
</dependency> | ||
<dependency> | ||
<groupId>unknown.binary</groupId> | ||
<artifactId>AbsoluteLayout</artifactId> | ||
<version>SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.universl.massmailer.db; | ||
|
||
import org.apache.log4j.Logger; | ||
import java.sql.Connection; | ||
import java.sql.DriverManager; | ||
|
||
public class DBConnect { | ||
|
||
private static Logger logger = Logger.getLogger(DBConnect.class); | ||
private static Connection con = null; | ||
private static String dbName = PropertyLoader.dbName; | ||
private static String dbUser = PropertyLoader.dbUser; | ||
private static String dbPass = PropertyLoader.dbPass; | ||
|
||
public Connection connect() { | ||
if (con == null) { | ||
try { | ||
Class.forName("com.mysql.jdbc.Driver").newInstance(); | ||
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/" + dbName + "?autoReconnect=true", dbUser, dbPass); | ||
|
||
if (!con.isClosed()) { | ||
logger.info("Mysql Connected Successfully.."); | ||
} | ||
} catch (Exception e) { | ||
logger.error("Mysql not Connected.. : " + e.getMessage()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
return con; | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
src/main/java/com/universl/massmailer/db/PropertyLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.universl.massmailer.db; | ||
|
||
import org.apache.log4j.Logger; | ||
import java.io.FileInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
public class PropertyLoader { | ||
|
||
private static Logger logger = Logger.getLogger(PropertyLoader.class); | ||
public static Properties properties = new Properties(); | ||
public static String dbName = null; | ||
public static String dbUser = null; | ||
public static String dbPass = null; | ||
public static String smtpHost = null; | ||
public static String smtpPort = null; | ||
public static String smtpUser = null; | ||
public static String smtpPass = null; | ||
|
||
public static String getOsName() { | ||
return System.getProperty("os.name", "unknown"); | ||
} | ||
|
||
public static boolean isWindows() { | ||
return (getOsName().toLowerCase().indexOf("windows") >= 0); | ||
} | ||
|
||
public static boolean isLinux() { | ||
return getOsName().toLowerCase().indexOf("linux") >= 0; | ||
} | ||
|
||
public PropertyLoader() { | ||
try { | ||
String path = null; | ||
if (isLinux()) { | ||
path = "/home/bulk.properties"; | ||
logger.info("Linux System, properties file is in /home/bulk.properties"); | ||
} else if (isWindows()) { | ||
path = "C:\\bulk.properties"; | ||
logger.info("Windows System, properties file is in C:/bulk.properties"); | ||
} | ||
InputStream inputStream = new FileInputStream(path); | ||
properties.load(inputStream); | ||
getDbProperties(); | ||
getSMTPDetails(); | ||
logger.info("Property file loaded Successfully.."); | ||
|
||
} catch (IOException e) { | ||
logger.error("Error occurred while reading the properties file"); | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private void getSMTPDetails() { | ||
try { | ||
smtpHost = properties.getProperty("smtp.host"); | ||
smtpPort = properties.getProperty("smtp.port"); | ||
smtpUser = properties.getProperty("smtp.user"); | ||
smtpPass = properties.getProperty("smtp.pass"); | ||
} catch (Exception e) { | ||
} | ||
} | ||
|
||
private void getDbProperties() { | ||
try { | ||
dbUser = properties.getProperty("db.user"); | ||
dbPass = properties.getProperty("db.pass"); | ||
dbName = properties.getProperty("db.name"); | ||
} catch (Exception e) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.universl.massmailer.logic; | ||
import javax.mail.Authenticator; | ||
import javax.mail.PasswordAuthentication; | ||
|
||
public class Auth extends Authenticator { | ||
private String emailId, password; | ||
|
||
public Auth(String emailId, String password) { | ||
this.emailId = emailId; | ||
this.password = password; | ||
} | ||
|
||
public PasswordAuthentication getPasswordAuthentication() { | ||
return new PasswordAuthentication(emailId, password); | ||
} | ||
} |
Oops, something went wrong.