-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#218: Made Email serializable (except for attached/embedded DataSourc…
…es, which is out of our control)
- Loading branch information
Benny Bottema
authored and
Benny Bottema
committed
Sep 27, 2019
1 parent
820dcf9
commit 543995e
Showing
4 changed files
with
39 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.simplejavamail.email; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.io.ObjectOutputStream; | ||
import java.io.OutputStream; | ||
|
||
public class EmailTest { | ||
|
||
@Test | ||
public void testSerialization() throws IOException { | ||
Email e = EmailBuilder.startingBlank() | ||
.from("lollypop", "[email protected]") | ||
.withReplyTo("lollypop-reply", "[email protected]") | ||
.withBounceTo("lollypop-bounce", "[email protected]") | ||
.to("C.Cane", "[email protected]") | ||
.withPlainText("We should meet up!") | ||
.withHTMLText("<b>We should meet up!</b><img src='cid:thumbsup'>") | ||
.withSubject("hey") | ||
.withDispositionNotificationTo("[email protected]") | ||
.withReturnReceiptTo("Complex Email", "[email protected]") | ||
.withHeader("dummyHeader", "dummyHeaderValue") | ||
.buildEmail(); | ||
|
||
OutputStream fileOut = new ByteArrayOutputStream(); | ||
ObjectOutputStream out = new ObjectOutputStream(fileOut); | ||
out.writeObject(e); | ||
out.close(); | ||
fileOut.close(); | ||
} | ||
} |