Results 1 to 1 of 1
- 05-12-2008, 04:28 PM #1
Member
- Join Date
- May 2008
- Posts
- 1
- Rep Power
- 0
error 530 error authentication required
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);
objSession.setDebug(true);
//send the email
try
{
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();
objMbp1.setText(strMessageBody);
//objMbp1.setContent(strMessageBody,"text/html");
Multipart objMp = new MimeMultipart();
objMp.addBodyPart(objMbp1);
objMimeMessage.setContent(objMp);
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());
transport.close();
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
Rob
Similar Threads
-
Error: invalid method declaration; return type required
By silvia in forum AWT / SwingReplies: 3Last Post: 06-05-2010, 08:05 PM -
Error: incompatible types, found: int required: boolean
By silvia in forum New To JavaReplies: 6Last Post: 10-08-2008, 08:09 AM -
java mail 530 authentication required --help
By ravinder.kadiyan in forum Java ServletReplies: 1Last Post: 04-30-2008, 10:08 AM -
530 5.7.0 Authentication Required - JavaMail gmail
By simon in forum Advanced JavaReplies: 1Last Post: 07-14-2007, 11:52 PM -
JavaMail:Authentication required error
By bbq in forum Advanced JavaReplies: 1Last Post: 07-05-2007, 04:16 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks