Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1828:09e90d94b7b5 | 1829:0eb615de1f80 |
|---|---|
| 15 private final Socket socket; | 15 private final Socket socket; |
| 16 private final Reader reader; | 16 private final Reader reader; |
| 17 private final Writer writer; | 17 private final Writer writer; |
| 18 public final String ehlo; | 18 public final String ehlo; |
| 19 | 19 |
| 20 public Smtp(Socket socket) throws IOException, MailException { | 20 public Smtp(Socket socket,String helo) throws IOException, MailException { |
| 21 this.socket = socket; | 21 this.socket = socket; |
| 22 this.reader = new InputStreamReader(socket.getInputStream()); | 22 this.reader = new InputStreamReader(socket.getInputStream()); |
| 23 this.writer = new OutputStreamWriter(socket.getOutputStream()); | 23 this.writer = new OutputStreamWriter(socket.getOutputStream()); |
| 24 String s = read(); | 24 String s = read(); |
| 25 if( !s.startsWith("220") ) | 25 if( !s.startsWith("220") ) |
| 26 throw new MailException(s); | 26 throw new MailException(s); |
| 27 write( "EHLO whatever\r\n" ); | 27 write( "EHLO " + helo + "\r\n" ); |
| 28 ehlo = read(); | 28 ehlo = read(); |
| 29 if( !ehlo.startsWith("250") ) | 29 if( !ehlo.startsWith("250") ) |
| 30 throw new MailException(ehlo); | 30 throw new MailException(ehlo); |
| 31 } | 31 } |
| 32 | 32 |
