Log4j comes with an appender that will send an email when a logging event occurs. The appender class is org.apache.log4j.net.SMTPAppender and the following gives an example of its configuration
<appender name="LogEmail" class="org.apache.log4j.net.SMTPAppender">
<param name="BufferSize" value="512" />
<param name="SMTPHost" value="mail.server.com" />
<param name="From" value="myapp@server.com" />
<param name="To" value="support@server.com" />
<param name="Subject" value="Log from myapp" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%p %t %c - %m%n" />
</layout>
</appender>
written by objects
\\ tags: email, log4j, mail
If you’re having trouble getting your iphone to connect to your plesk mail server then it may be due to limited imap connections being available.
By default a plesk server only allows a maximum of 4 IMAP connections from the one IP. If you have a few computers behind a router then these can quickly get used up. Once users start trying to also connect with iphones the problem quickly gets worse.
To fix the maximum number of connections needs to be uincreased. The configuration file that needs to be changed is:
/etc/courier-map/imapd
And the setting that needs to be changed is:
MAXPERIP=4
Try increasing it to say 10 or 20, or whatever is appropriate in your environment.
For sites with lots of users the MAXDAEMONS setting may also need to be increased.
Once that is changed you just need to restart the imap service.
sudo /etc/init.d/courier-imap restart
written by Obiweb
\\ tags: imapd, iphone, mail, MAXPERIP, plesk
Use JavaMail API
// Create session
Properties sessionProperties = System.getProperties();
sessionProperties.put("mail.smtp.host", smtpServer);
Session session =
Session.getDefaultInstance(sessionProperties, null);
// Create message
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
message.setSubject(subject);
message.setText(body);
// Send the message
Transport.send(message);
written by objects
\\ tags: javamail, mail, smtp
Recent Comments