}
public void signAndSend(long secret, Date now) throws IOException, Message.Malformed {
- SMTP.Outgoing.accept(new Message(new Stream("From: " + FROM + "\r\n" +
- "To: " + who.toString(true) + "\r\n" +
- "Subject: confirm " + getDescription() + "\r\n" +
- "\r\n" +
- "Please click the link below to " + getDescription() + "\r\n" +
- sign(secret)),
- new Message.Envelope(FROM, who, now)
- )
+ SMTP.Outgoing.accept(Message.newMessage(new Stream("From: " + FROM + "\r\n" +
+ "To: " + who.toString(true) + "\r\n" +
+ "Subject: confirm " + getDescription() + "\r\n" +
+ "\r\n" +
+ "Please click the link below to " + getDescription() + "\r\n" +
+ sign(secret)),
+ FROM, who)
);
}
public void accept(Message m) throws IOException, MailException {
try {
- m = new Message(new Stream("List-Id: " + one_line_description + "<"+address+">\r\n" +
+ m = Message.newMessage(new Stream("List-Id: " + one_line_description + "<"+address+">\r\n" +
m.toString() +
"--\r\n" +
message_footer + "\r\n" +
- "to unsubscribe, go to " + homepage + "\r\n"),
- null);
+ "to unsubscribe, go to " + homepage + "\r\n"));
} catch (Exception e2) {
Log.error("[list]", e2);
throw new IOException(e2.toString());
String s = subscribers[i];
try {
Log.warn(List.class, " trying " + s);
- SMTP.Outgoing.accept(new Message(new Stream(m.toString()), new Message.Envelope(address, Address.parse(s), new Date())));
+ SMTP.Outgoing.accept(Message.newMessage(new Stream(m.toString()), address, Address.parse(s)));
Log.warn("[list]", "successfully sent to " + s);
} catch (Exception e2) {
Log.error("[list]", e2);
"</form>\r\n"+
"</body></html>\r\n";
try {
- captchaMessage = new Message(new Stream(str), null);
+ captchaMessage = Message.newMessage(new Stream(str));
} catch (Message.Malformed e) {
Log.warn(this, e);
throw new IOException(e.toString());
Stream thestream =
new Stream(new HTTP(gmail+"?search=query&start=0&view=om&th=" + URLEncoder.encode(id)).GET(null, jar));
thestream.readln();
- return message = new Message(thestream, null);
+ return message = Message.newMessage(thestream);
}
public Summary(JSArray m) {
public void delete(Mailbox m) { if (!m.equals(inbox)) m.destroy(false); else throw new Bad("can't delete inbox"); }
public void create(String m) { mailbox(m, true, false); }
public void append(String m,int f,Date a,String b) { try {
- mailbox(m,false).add(new Message(new Stream(b), new Message.Envelope(null,null,a)),f|Mailbox.Flag.RECENT);
+ mailbox(m,false).add(Message.newMessage(new Stream(b)),f|Mailbox.Flag.RECENT);
} catch (Message.Malformed e) { throw new No(e.getMessage()); } }
public void check() { }
public void noop() { }
for(String s = stream.readln(); ; s = stream.readln()) {
if (s == null || s.startsWith("From ")) {
try {
- if (buf != null) vec.addElement(new Message(new Stream(buf.toString()), null));
+ if (buf != null) vec.addElement(Message.newMessage(new Stream(buf.toString())));
} catch (Exception e) { Log.warn(Mbox.class, e); }
if (s == null) break;
buf = new StringBuffer();
FileInputStream fis = null;
try {
fis = new FileInputStream(cache.dir.getParent() + slash + name);
- return new Message(new Stream(fis), new Message.Envelope(null, null, new Date()));
+ return Message.newMessage(new Stream(fis));
} finally { if (fis != null) fis.close(); }
} catch (IOException e) { throw new MailException.IOException(e);
} catch (Message.Malformed e) { throw new MailException(e.getMessage()); }
if (s == null || s.startsWith("From ")) {
if (acc != null) {
Log.warn("[msg]", acc.toString());
- all.addElement(new Message(new Stream(acc.toString()), null));
+ all.addElement(Message.newMessage(new Stream(acc.toString())));
}
if (s == null) break;
acc = new StringBuffer();
if ("from".equalsIgnoreCase(key)) from = Address.parse(val);
if ("to".equalsIgnoreCase(key)) to = Address.parse(val);
}
- Message message = new Message(new org.ibex.io.Stream(headers.toString() + "\r\n" + body),
- new Message.Envelope(from,
- to,
- new Date()));
+ Message message = Message.newMessage(new org.ibex.io.Stream(headers.toString() + "\r\n" + body), from, to);
//org.ibex.mail.protocol.SMTP.Outgoing.accept(message);
boolean ok = org.ibex.mail.protocol.SMTP.Outgoing.attempt(message);
if (!ok) throw new JSExn("SMTP server rejected message");
if (name.equals("mail.forward")) { return new Target() {
public void accept(Message m) throws MailException {
try {
- Message m2 = new Message(new org.ibex.io.Stream(m.toString()),
- new Message.Envelope(m.envelope.from,
- new Address(a.toString()),
- new Date()));
+ Message m2 = Message.newMessage(new org.ibex.io.Stream(m.toString()),
+ m.envelopeFrom,
+ new Address(a.toString()));
org.ibex.mail.protocol.SMTP.Outgoing.accept(m2);
} catch (Exception e) {
throw new MailException(e.toString());