package net.methodyne.demo; import net.methodyne.bellvue.core.Sdata; import net.methodyne.bellvue.core.SMTPMailer; import net.methodyne.bellvue.core.ResultObject; import java.io.Serializable; import java.util.Date; /** * Created by Methodyne GmbH. * User: yuri * Date: 19.05.2003 * Time: 10:08:19 * */ public class Mailer implements Serializable{ public long id = -1l; public String to = ""; public String subject = ""; public String message = ""; // this means only the user created this can see this object! public long referencePrivateUser = -1l; public String getTitle(){ int nl = subject.length(); if(nl == 0){ return "new email"; } else if( nl > 30 ){ return subject.substring(0, 30 ).trim(); } else{ return subject; } } public String aboutSend(Sdata sd){ return "on"; } public void actionSend(Sdata sd){ net.methodyne.bellvue.core.SMTPMailer sm = new net.methodyne.bellvue.core.SMTPMailer(); net.methodyne.bellvue.core.ResultObject res = new net.methodyne.bellvue.core.ResultObject(); res.title = "Email delivery status."; System.out.println("Mailer:DNS: " + sd.dns); if(sd.dns == null) sd.dns = ""; if( (sd.user != null) ) if( sd.user.email.indexOf("@") <2 ) res.result = sm.mail(sd.dns, "info@methodyne.net", to, subject, message); else res.result = sm.mail(sd.dns, sd.user.email, to, subject, message); else res.result = sm.mail(sd.dns, "info@methodyne.net", to, subject, message); sd.view.add(res); sm = null; } public String dispSubject(Sdata sd){ return "AREA,40,1"; } public String dispMessage(Sdata sd){ return "AREA,40,10"; } }