Hi, i already read this tutorial from here and i have download all required libraries (Log4j, JavaMail API ,Activation framework) . But when i trying running this program i got this error
log4j:WARN No appenders could be found for logger (org.codemonkey.vesijama.Mailer). org.codemonkey.vesijama.MailException: Generic error: Exception reading response log4j:WARN Please initialize the log4j system properly.
this is the source code i use
import javax.mail.Message.RecipientType;
import org.codemonkey.vesijama.Email;
import org.codemonkey.vesijama.MailException;
import org.codemonkey.vesijama.Mailer;
import org.apache.log4j.*;
public class testSend {
final Email email = new Email();
static Logger log = Logger.getLogger(mailmailan.class);
public testSend{
try{
BasicConfigurator.configure();
email.setFromAddress("test", "[email protected]");
email.setSubject("hey");
email.addRecipient("hai", "[email protected]", RecipientType.TO);
email.setText("We should meet up!");
email.setTextHTML("<b>We should meet up!</b>");
email.addAttachment("output.xls", odfDatasource);
new Mailer("smtp.gmail.com", 465, "[email protected]", "XXXXXX").sendMail(email);
}
catch(MailException me)
{
System.out.println(me);
}
}
}
i have also trying using port 587. but i got same error >.<
btw , it say can add attachments what should i write if i want to attach .xls ( microsoft excel 2003) ?
Thx B4.
Edit : i have success send mail (Add log4j.xml in every folder @.@), but i still failed to addAttachment. And i just change my source code.