coding error cannot resolve
i having this kind of error:
sendMail.java:89: illegal start of type
return true;
^
sendMail.java:89: <identifier> expected
return true;
^
sendMail.java:92: 'class' or 'interface' expected
}
^
sendMail.java:93: 'class' or 'interface' expected
^
4 errors
and my application coding are:
package common;
import java.util.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
import java.sql.*;
import java.lang.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class sendMail{
public void sending(String Address,String content,String subject,String attachment,String from_address, String host){
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Define message
MimeMessage message = new MimeMessage(session);
try
{
message.setFrom(new InternetAddress(from_address));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(Address));
message.setSubject(subject);
message.setText(content);
// Send message
Transport.send(message);
}
catch (MessagingException e)
{
System.err.println("Caught Exception: "
+ e.getMessage());
}{
boolean retryFlag = true;
// Log the error
synchronized (logger) {
errorHandler.error("[COULDNT_SEND_MESSAGE]", e);
if (e instanceof SendFailedException) {
SendFailedException sfe = (SendFailedException) e;
Address[] invalid = sfe.getInvalidAddresses();
addressWarning("[INVALID_ADDRESSES]", invalid);
Address[] validUnsent = sfe.getValidUnsentAddresses();
addressWarning("[VALID_UNSENT_ADDRESSES]", validUnsent);
Address[] validSent = sfe.getValidSentAddresses();
addressWarning("[VALID_SENT_ADDRESSES]", validSent);
if (invalid != null && invalid.length > 0)
retryFlag = false; // there is no point to retry
}
}
// Retry with a new transport object. Don't log any new errors.
if (retryFlag) {
Transport newTransport = null;
try {
// Try to resend the message using a new connection
newTransport = session.getTransport(protocol);
newTransport.connect();
newTransport.sendMessage(msg, msg.getAllRecipients());
// Try to close the old transport
try {
transport.close();
} catch (Exception t) {
}
// The new transport object worked
transport = newTransport;
return true;
} catch (Exception t) {
// The new transport failed too. Try to close it
if (newTransport != null)
try {
newTransport.close();
} catch (Exception t2) {
}
}
return false;
}
}
return true;
}
}
can someone help me to solve. i already use my whole day time try to solve the problem, but i still cannot get it. who expert on this field please open your kindly heart, give a way out to me. thank you.
regards,
albert

