Socket smtp = new Socket("localhost", 25);
PrintWriter out = new PrintWriter(smtp.getOutputStream());
Socket smtp = new Socket("localhost", 25);
PrintWriter out = new PrintWriter(smtp.getOutputStream());
- BufferedReader in = new BufferedReader(new InputStreamReader(smtp.getInputStream()));
- readResponse(in);
+ BufferedReader in = new BufferedReader(new InputStreamReader(smtp.getInputStream(), "UTF-8"));
+ readSMTPResponse(in, 220);
out.print("X-Mailer: CAcert.org Website\r\n");
// if (array_key_exists("REMOTE_ADDR", $_SERVER)) {
// out.print("X-OriginatingIP: ".$_SERVER["REMOTE_ADDR"]."\r\n");
out.print("X-Mailer: CAcert.org Website\r\n");
// if (array_key_exists("REMOTE_ADDR", $_SERVER)) {
// out.print("X-OriginatingIP: ".$_SERVER["REMOTE_ADDR"]."\r\n");
// TODO
SimpleDateFormat emailDate = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss ZZZZ (z)", Locale.ENGLISH);
out.print("Date: " + emailDate.format(new Date(System.currentTimeMillis())) + "\r\n");
// TODO
SimpleDateFormat emailDate = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss ZZZZ (z)", Locale.ENGLISH);
out.print("Date: " + emailDate.format(new Date(System.currentTimeMillis())) + "\r\n");
- out.print("Sender: " + errorsto + "\r\n");
- out.print("Errors-To: " + errorsto + "\r\n");
+ if (errorsto != null) {
+ out.print("Sender: " + errorsto + "\r\n");
+ out.print("Errors-To: " + errorsto + "\r\n");
+ }