Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Version 0.2.0
- Loading branch information
Josh Lospinoso
committed
Nov 1, 2015
1 parent
1b88e10
commit c244438
Showing
35 changed files
with
781 additions
and
43 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
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
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
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
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
25 changes: 25 additions & 0 deletions
25
dailyc-core/src/main/groovy/net/lospi/dailyc/comm/MailSender.groovy
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,25 @@ | ||
package net.lospi.dailyc.comm | ||
|
||
import groovy.util.logging.Slf4j | ||
import net.lospi.dailyc.core.EmailSubscriber | ||
import net.lospi.dailyc.core.ImageFile | ||
import net.lospi.dailyc.core.MessageBody | ||
import net.lospi.mail.MailManager | ||
import net.lospi.mail.core.EmailSendRequest | ||
|
||
@Slf4j | ||
class MailSender { | ||
MailManager mailManager | ||
String from | ||
|
||
def send(EmailSubscriber emailSubscriber, MessageBody messageBody, ImageFile imageFile) { | ||
log.info("[ ] Sending image {} to email {}; message: {}", imageFile, emailSubscriber, messageBody) | ||
def request = new EmailSendRequest(emailSubscriber.address, from, messageBody.contents, imageFile.image) | ||
def result = mailManager.send(request) | ||
if(result.successful) | ||
log.info("[+] Success! Response from mail server: {}", result.messageResponse) | ||
else | ||
log.error("[-] Failure! Response from mail server: %n{}", result.messageResponse) | ||
return result | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
dailyc-core/src/main/groovy/net/lospi/dailyc/comm/MogreetSender.groovy
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
28 changes: 28 additions & 0 deletions
28
dailyc-core/src/main/groovy/net/lospi/dailyc/core/EmailSubscriber.groovy
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,28 @@ | ||
package net.lospi.dailyc.core | ||
|
||
import grails.persistence.Entity | ||
|
||
@Entity | ||
class EmailSubscriber { | ||
String address | ||
Date lastUse | ||
|
||
static hasMany = [ | ||
sentEmail : SentEmail | ||
] | ||
|
||
static constraints = { | ||
lastUse(nullable: true) | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return """\ | ||
EmailSubscriber{ | ||
id=$id, | ||
address='$address', | ||
lastUse=$lastUse, | ||
version=$version | ||
}""" | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
dailyc-core/src/main/groovy/net/lospi/dailyc/core/NoEmailSubscribersException.groovy
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,4 @@ | ||
package net.lospi.dailyc.core | ||
|
||
class NoEmailSubscribersException { | ||
} |
22 changes: 22 additions & 0 deletions
22
dailyc-core/src/main/groovy/net/lospi/dailyc/core/SentEmail.groovy
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,22 @@ | ||
package net.lospi.dailyc.core | ||
|
||
import grails.persistence.Entity | ||
|
||
@Entity | ||
class SentEmail { | ||
EmailSubscriber emailSubscriber | ||
MessageBody messageBody | ||
ImageFile imageFile | ||
Date sentDate | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("SentEmail{"); | ||
sb.append("emailSubscriber=").append(emailSubscriber); | ||
sb.append(", messageBody=").append(messageBody); | ||
sb.append(", imageFile=").append(imageFile); | ||
sb.append(", sentDate=").append(sentDate); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
} |
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
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
Oops, something went wrong.