• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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