0

We send mails to registered user from our application using the below mentioned code in Java.

However mail received by them turns out to be very simple and hence we need to edit it.

I need to write the same content to an image background and then transmit this image as an e-mail to the users.

Is there a way out to achieve this purpose.We use SMTP transport to send messages.

Code snippet shows the present way of writing contents to message.

String from = "blah@abc.com";
String to[] = new String[]{variable};
String subject = "Subject";

StringBuffer content = new StringBuffer();
        content.append("");
        content.append("");
        content.append("");
        content.append(variable);

Is there a way out to write all the stuff on an pre identified image and then send this image as the body of the email.

AngelsandDemons
  • 2,823
  • 13
  • 47
  • 70

1 Answers1

0

These answers will tell you how to put an image into an email message:

  1. Adding image to email via Java mail
  2. Sending mail along with embedded image using javamail
  3. Inline images in email using JavaMail

As for rendering the text of an email to an image. Either use some HTML viewer and have it render on a Graphics context you create, or determine the size of the image required (using Graphics) and render onto the Graphics (agian) of a BufferedImage you create:

BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
img.getGraphics()
Community
  • 1
  • 1
daveb
  • 74,111
  • 6
  • 45
  • 51