• Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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