citi

Greenhorn
+ Follow
since Jun 27, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by citi

Hi i am sending the email with attachement via java mail i am getting the error
Exception in thread "main" javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 571 <anandavasan.srinivasan@citicorp.com>... we do not relay
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at javax.mail.MessagingException.<init>(MessagingException.java:55)
at javax.mail.SendFailedException.<init>(SendFailedException.java:76)
at javax.mail.Transport.send0(Compiled Code)
at javax.mail.Transport.send(Transport.java:81)
at mycitibanker.service.report.HtmlImageExample.main(HtmlImageExample.java:79)

I have attached the Program

// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getDefaultInstance(props, null);
// Create the message
Message message = new MimeMessage(session);
// Fill its headers
message.setSubject("Embedded Image");
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
BodyPart messageBodyPart = new MimeBodyPart();
// Create part for the image
messageBodyPart = new MimeBodyPart();
// Fetch the image and associate to part
DataSource fds = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(fds));
//messageBodyPart.setHeader("Content-ID","memememe");
// Add part to multi-part
multipart.addBodyPart(messageBodyPart);
// Create 2nd part for the image
messageBodyPart = new MimeBodyPart();
// Fetch the image and associate to part
DataSource fds2 = new FileDataSource(file2);
messageBodyPart.setDataHandler(new DataHandler(fds2));
//messageBodyPart.setHeader("Content-ID","youyouyou");
// Add part to multi-part
multipart.addBodyPart(messageBodyPart);
// Associate multi-part with message
message.setContent(multipart);
transport = session.getTransport("smtp");
// Send message
transport.send(message);
17 years ago