-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now with HTML incoming mails, HTML version button will be sent, to view content in broser with html data. Fix #28
- Loading branch information
Showing
8 changed files
with
169 additions
and
11 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 |
---|---|---|
|
@@ -13,6 +13,7 @@ src/main/resources/application.yml | |
*.db | ||
lib/ | ||
bin/ | ||
*.html | ||
|
||
### STS ### | ||
.apt_generated | ||
|
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
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 |
---|---|---|
|
@@ -110,7 +110,6 @@ public String toString() { | |
this.subject, | ||
this.content | ||
); | ||
|
||
return mailData; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/io/github/trashemail/utils/SaveMailToHTMLFile.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,40 @@ | ||
package io.github.trashemail.utils; | ||
|
||
import io.github.trashemail.Configurations.TrashemailConfig; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.mail.Message; | ||
import java.io.FileWriter; | ||
import java.util.UUID; | ||
|
||
@Component | ||
public class SaveMailToHTMLFile { | ||
@Autowired | ||
TrashemailConfig trashemailConfig; | ||
|
||
private static final Logger log = LoggerFactory.getLogger( | ||
SaveMailToHTMLFile.class); | ||
|
||
public Object saveToFile(String htmlContent){ | ||
try { | ||
String filename = UUID.randomUUID().toString() + ".html"; | ||
|
||
FileWriter myWriter = new FileWriter( | ||
trashemailConfig.getDownloadPath() + filename); | ||
|
||
myWriter.write(htmlContent); | ||
myWriter.close(); | ||
|
||
log.debug("File written to disk: "+ filename); | ||
return filename; | ||
} | ||
catch (Exception e) { | ||
log.error("Unable to save to HTML file. " + e.getMessage()); | ||
return null; | ||
} | ||
} | ||
} |