]> jaekl.net Git - cfb.git/commitdiff
DM_DEFAULT_ENCODING: Be explicit that we're using 7-bit ASCII when sending email.
authorChris Jaekl <cejaekl@yahoo.com>
Sun, 13 Dec 2015 05:15:34 +0000 (14:15 +0900)
committerChris Jaekl <cejaekl@yahoo.com>
Sun, 13 Dec 2015 05:15:34 +0000 (14:15 +0900)
prod/net/jaekl/qd/util/SendMail.java

index b4c783488431f86bb53774569ac305e71774a9cb..33be358b31edc0c28e7b232861e89419a76357ca 100644 (file)
@@ -3,11 +3,13 @@ package net.jaekl.qd.util;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.net.InetAddress;
 import java.net.Socket;
 import java.net.UnknownHostException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -66,7 +68,7 @@ public class SendMail {
        {
                try (
                                Socket sock = openSocket(m_smtpHost, m_smtpPort);
-                               PrintWriter pw = new PrintWriter(sock.getOutputStream(), true);
+                               PrintWriter pw = new PrintWriter(new OutputStreamWriter(sock.getOutputStream(), StandardCharsets.US_ASCII), true);
                                BufferedReader br = new BufferedReader(new InputStreamReader(sock.getInputStream(), getCharset()));
                        ) 
                {