• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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