diff src/goodjava/mail/Smtp.java @ 1829:0eb615de1f80

add mail helo
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 22 Sep 2024 20:05:54 -0600
parents 1ffe1e06ea55
children d72a52232f79
line wrap: on
line diff
--- a/src/goodjava/mail/Smtp.java	Sun Sep 15 19:51:16 2024 -0600
+++ b/src/goodjava/mail/Smtp.java	Sun Sep 22 20:05:54 2024 -0600
@@ -17,14 +17,14 @@
 	private final Writer writer;
 	public final String ehlo;
 
-	public Smtp(Socket socket) throws IOException, MailException {
+	public Smtp(Socket socket,String helo) throws IOException, MailException {
 		this.socket = socket;
 		this.reader = new InputStreamReader(socket.getInputStream());
 		this.writer = new OutputStreamWriter(socket.getOutputStream());
 		String s = read();
 		if( !s.startsWith("220") )
 			throw new MailException(s);
-		write( "EHLO whatever\r\n" );
+		write( "EHLO " + helo + "\r\n" );
 		ehlo = read();
 		if( !ehlo.startsWith("250") )
 			throw new MailException(ehlo);