• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Configuring mail server such a way to use in java application

K

karthikeyan

Guest
Hi guys,

I am using plesk 8.2. i have a java application in such a way that it use plesk mail server to send mail. so how do i want to configure in succh a way that i can use in the application.

Regards,
karthi
 
I don't think there will be much to configure. What method are you using to send email? You should be able to use SMTP or sendmail on localhost.
 
I am using SMTP
(org.springframework.mail.javamail) method to send the mail.

below is the code i used to implement this,

JavaMailSenderImpl mailSender = new JavaMailSenderImpl();

MailDO mailDO = new MailDO();
mailDO.setTo(To_email);
mailDO.setFrom(From_email);
mailDO.setCc(Cc_email);
mailDO.setSubject(Subject);

Properties prop = new Properties();
prop.put("mail.smtp.auth", "true");

mailSender.setHost("smtp.domain.co.in");
mailSender.setUsername("[email protected]");
mailSender.setPassword("password");

mailSender.setProtocol("smtp");
mailSender.setPort(25);
mailSender.setJavaMailProperties(prop);
MimeMessage message = mailSender.createMimeMessage();

MimeMessageHelper helper = new MimeMessageHelper(message);
helper.setFrom(mailDO.getFrom());
helper.setCc(ccAddColl);
helper.setSubject(mailDO.getSubject());
helper.setTo(mailDO.getTo());
helper.setText(mailDO.getBody(),true);

try{
mailSender.send(message);
}
catch(MailException ex) {
System.err.println(ex.getMessage());
ex.printStackTrace();
}

But i am getting following error :-


Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: smtp
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: smtp
javax.mail.NoSuchProviderException: smtp
at javax.mail.Session.getService(Session.java:760)
at javax.mail.Session.getTransport(Session.java:685)
at javax.mail.Session.getTransport(Session.java:628)
at javax.mail.Session.getTransport(Session.java:608)


i am not sure if this is required but it might help you, how i used smtp.
 
That looks like a problem with your code or Java install rather than with the SMTP server. NoSuchProviderException: "This exception is thrown when a particular security provider is requested but is not available in the environment." Maybe a Java forum can be of more assistance.
 
Back
Top