Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mongo-mail-example
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cylab
mongo-mail-example
Commits
cd7002ca
Commit
cd7002ca
authored
5 years ago
by
Bunyamin Aslan
Browse files
Options
Downloads
Patches
Plain Diff
Up to date with release 0.4
parent
c03d871b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#1283
passed
5 years ago
Stage: test
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.env
+9
-9
9 additions, 9 deletions
.env
nbactions.xml
+17
-0
17 additions, 0 deletions
nbactions.xml
pom.xml
+1
-1
1 addition, 1 deletion
pom.xml
src/main/java/be/cylab/mongomailexample/Main.java
+9
-1
9 additions, 1 deletion
src/main/java/be/cylab/mongomailexample/Main.java
with
36 additions
and
11 deletions
.env
+
9
−
9
View file @
cd7002ca
...
...
@@ -3,25 +3,25 @@
# Server settings
#Port where the server will be listening
SERVER_PORT=8025
MONGOMAIL_
SERVER_PORT=8025
#Hostname of the server
SERVER_HOSTNAME=localhost
MONGOMAIL_
SERVER_HOSTNAME=localhost
#How many thread are always running in the server (even if no client to handle)
#CONNECTION_CORE=0
#Max connection that can handle the server at the same time
CONNECTION_MAX=1024
MONGOMAIL_
CONNECTION_MAX=1024
#Seconds that have the client to send the mail
IDLE_TIMEOUT=5
MONGOMAIL_
IDLE_TIMEOUT=5
# DB settings
#MongoDb host IP
DB_HOST=127.0.0.1
MONGOMAIL_
DB_HOST=127.0.0.1
#MongoDb Port (generally 27017 if localhost)
DB_PORT=27017
MONGOMAIL_
DB_PORT=27017
#MongoDb database name to use
DB_NAME=mydb
MONGOMAIL_
DB_NAME=mydb
#MongoDb collection name to use (to store mails)
COLLECTION_NAME=mail_collection
MONGOMAIL_
COLLECTION_NAME=mail_collection
#MongoDb bucket name to use (to store files)
BUCKET_NAME=attachments
MONGOMAIL_
BUCKET_NAME=attachments
This diff is collapsed.
Click to expand it.
nbactions.xml
0 → 100644
+
17
−
0
View file @
cd7002ca
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>
run
</actionName>
<packagings>
<packaging>
jar
</packaging>
</packagings>
<goals>
<goal>
process-classes
</goal>
<goal>
org.codehaus.mojo:exec-maven-plugin:1.5.0:exec
</goal>
</goals>
<properties>
<exec.args>
-classpath %classpath be.cylab.mongomailexample.Main
</exec.args>
<exec.executable>
java
</exec.executable>
</properties>
</action>
</actions>
This diff is collapsed.
Click to expand it.
pom.xml
+
1
−
1
View file @
cd7002ca
...
...
@@ -24,7 +24,7 @@
<dependency>
<groupId>
be.cylab
</groupId>
<artifactId>
mongo-mail
</artifactId>
<version>
0.0.
2
</version>
<version>
0.0.
4
</version>
</dependency>
<dependency>
<groupId>
org.mongodb
</groupId>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/be/cylab/mongomailexample/Main.java
+
9
−
1
View file @
cd7002ca
...
...
@@ -32,9 +32,11 @@ public class Main {
* @throws AddressException exc.
* @throws MessagingException exc.
* @throws IOException exc.
* @throws java.lang.InterruptedException
*/
public
static
void
main
(
final
String
[]
args
)
throws
AddressException
,
MessagingException
,
IOException
{
throws
AddressException
,
MessagingException
,
IOException
,
InterruptedException
{
Server
.
launchServer
(
"./"
,
"./"
);
MailSender
mail_sender
=
new
MailSender
();
//Simple mail from bob to alice
...
...
@@ -56,9 +58,15 @@ public class Main {
mail_sender
.
addAttachment
(
new
Attachment
(
"attachments/doc.odt"
));
mail_sender
.
sendMail
();
//Waiting a little the library finishing its work
Thread
.
sleep
(
1000
);
//Retrieve the second mail, also download the attachment from mongodb
MailRetriever
retriever
=
new
MailRetriever
();
Document
mail2
=
retriever
.
retrieveMail
();
retriever
.
downloadAttachment
(
mail2
);
Server
.
stopServer
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment