2 package org
.de
.metux
.util
;
9 String from
= "roboter@metux.de";
10 String to
= "weigelt@metux.de";
11 String subject
= "bummsfallera";
12 String body
= "hello world";
18 static public void main(String args
[]) {
19 (new SendMail()).send();
22 java
.io
.BufferedReader _in
;
23 java
.io
.PrintWriter _out
;
25 protected void send(String s
) throws java
.io
.IOException
27 // Send the SMTP command
29 System
.out
.println("C: "+s
);
33 // Wait for the response
34 String line
= _in
.readLine();
36 System
.out
.println("S:" + line
);
44 java
.net
.Socket s
= new java
.net
.Socket("nibiru.local", 25);
45 _out
= new java
.io
.PrintWriter(s
.getOutputStream());
46 _in
= new java
.io
.BufferedReader(
47 new java
.io
.InputStreamReader(s
.getInputStream()));
50 send("HELO " + java
.net
.InetAddress
.getLocalHost().getHostName());
51 send("MAIL FROM: " + from
);
52 send("RCPT TO: " + to
);
54 _out
.println("Subject:" + subject
);
61 System
.err
.println("Error: " + e
);