I am JSP that sends out an email. I had this code working in a stand alone java application but when i try it in a JSP page I get "Error: 530 error authentication required". I am not sure why as this was working for several months. Has anybody had similar issues?

Please note i have changed some of the parameters such as passwords, emails, and server names and have indicated where I have made changes.


String strError = "";
boolean blnSuccess = false;
String strMessageBody = "Badger Custom Mapping Request\n\n";

//Set the host smtp address
Properties objProperties = new Properties();
objProperties.put("mail.smtp.host","smtp.server.co m");//not the real server name
objProperties.put("mail.port", "587");//
objProperties.put("mail.smtp.transport.protocol", "smtp");//
objProperties.put("mail.smtp.user", "user");//not the real user
objProperties.put("mail.smtp.password", "password");// not the real password
objProperties.put("mail.smtp.auth", "true");//rg

// create some properties and get the default Session

Session objSession = Session.getDefaultInstance(objProperties, null);

//send the email

MimeMessage objMimeMessage = new MimeMessage(objSession);
objMimeMessage.setFrom(new InternetAddress("fromEmail@midwestsurveys.com"));//not the real email address
//InternetAddress[] objAddressTo = {new InternetAddress(strToEmail)};
InternetAddress[] objAddressTo = {new InternetAddress("toEmail@midwestsurveys.com")};//not the real email address
objMimeMessage.setRecipients(Message.RecipientType .TO, objAddressTo);
objMimeMessage.setSubject("Badger Custom Mapping Request");

MimeBodyPart objMbp1 = new MimeBodyPart();

Multipart objMp = new MimeMultipart();

objMimeMessage.setSentDate(new Date());

SMTPTransport transport = (SMTPTransport)objSession.getTransport("smtp");

transport.connect("smtp.midwestsurveys.com",587, "user","password");//not the real user and password

transport.sendMessage(objMimeMessage,objMimeMessag e.getAllRecipients());
blnSuccess = true;

catch (MessagingException mex)
strError = mex.getMessage();
catch(Exception ex)
strError = ex.getMessage();


if (blnSuccess!=true)
strError = "Email Message could not be sent.";


Thank you for reading this