All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spun.util.tests.EmailOpener Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
package com.spun.util.tests;

import com.spun.util.ObjectUtils;
import jakarta.mail.Message;

import java.io.File;
import java.io.FileOutputStream;

public class EmailOpener
{
  public static void displayEmail(Message email)
  {
    if (email == null)
    { return; }
    try
    {
      File f = File.createTempFile("email", ".eml");
      f.deleteOnExit();
      FileOutputStream out = new FileOutputStream(f);
      email.writeTo(out);
      out.close();
      TestUtils.displayFile(f.getAbsolutePath());
    }
    catch (Exception e)
    {
      throw ObjectUtils.throwAsError(e);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy