This code send email two times but i want only once
public void dbbackup_notify(String email,String data,String subject){
String toEmails = email;
Session session=Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, pass);
}
});
Message message=new MimeMessage(session);
try {
message.setFrom(new InternetAddress(userid));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toEmails));
message.setSubject(subject);
message.setText(data);
message.setContent(data,"text/html");
transport=session.getTransport("smtp");
transport.connect(host,user,pass);
transport.sendMessage(message,message.getAllRecipients());
transport.close();
System.out.println("Sent Successfully: "+ new Date());
} catch (AddressException e) {
e.printStackTrace();
} catch (MessagingException e) {
e.printStackTrace();
System.out.println("Don't Send Successfully"+ new Date());
}
}
View Answers
Ads
Related Tutorials/Questions & Answers:
Advertisements
java code to send an email
java
code to
send an email
i developed one java
code that has to
send a mail but
i am getting an runtime exception calledjavax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465;
nested
i want code for these programs
i want code for these programs Advances in operating system
Laboratory Work:
(The following programs can be executed on any... are created and the number of child processes created is fixed as
two
how to send sms on mobile and email using java code
how to
send sms on mobile and
email using java code hi....
I am developing a project where
I need to
send a confirmation/updation msg on clients mobile and also an
email on their particular
email id....plz help me to find
I want code below mention programe
I want code below mention programe Create a web application using any technology that accepts a keyword and displays 10 relevant tweets from Twitter in real-time for that keyword
how to send email
how to
send email hii
i am new for jsp-servlet and
i am making a project in jsp-servlet.
i want to
send the
email after registration to client.please
send me
code that how to
send mail after client registration.
thank you
Pls send code
Pls
send code I am Mohini Charankar
suppose Name="Mohini" Edit... that again
I want change my name click on edit button then it will generate an error pls
send code
plz send code for this
plz
send code for this Program to calculate the sum of
two big numbers (the numbers can contain more than 1000 digits). Don't use any library classes or methods (BigInteger etc
i want to update values
i want to update values in my form
i have 2 submit buttons one... database and it need to insert automatically in to disabled text boxs and
once i press... and later
once i press update it need to update details into database and before