I using 11g database..
I have created a procedure to send mail using java..as below
[code]
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "SendAttach" AS
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class SendAttach {
public static void sendmail(String recipient,String subject,String msg,String file)
{
String host="smtp.gmail.com";
final String user="memadhuh@gmail.com";//change accordingly
final String password="psd";//change accordingly
String to=recipient;//change accordingly
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user,password);
}
});
try {
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(user));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(to));
message.setSubject(subject);
BodyPart messageBodyPart1 = new MimeBodyPart(); //newly added
messageBodyPart1.setText(msg); //newly added
message.setText(msg);
MimeBodyPart messageBodyPart = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
messageBodyPart = new MimeBodyPart();
String file1 = file;
String fileName = "sql";
DataSource source = new FileDataSource(file1);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(fileName);
multipart.addBodyPart(messageBodyPart);
multipart.addBodyPart(messageBodyPart1);
message.setContent(multipart);
Transport.send(message);
System.out.println("message sent successfully...");
} catch (MessagingException e) {e.printStackTrace();}
}
}
/
It works finw with sysdba login.
But it gives below error when i connected as user(ori) my user name

Help me to resolve the problem...