axnet
axnet

Reputation: 5800

Apache commons Email Alias Not working Properly in scala

I am using HtmlEmail Class of ApacheCommons for sending HTML formatted email with embedded images

Apache Commons Email API (v1.4) is used in my Scala project

I am not Seeing the Alias (MY REPORTS) as sender name in my Received Email

Following is my Function

@throws(classOf[EmailException])
  @throws(classOf[Exception])
  def createHTMLEmailMessage(htmlContent: String): EmailMessage = {

    val email = new HtmlEmail

    // alternative message if the client does not support html

    email.setHtmlMsg(htmlContent)

    email.addTo("[email protected]")

    email.setFrom("[email protected]", "MY REPORTS")

    email.setHostName("MY_HOSTNAME")

    email.setSmtpPort(587)

    email.setAuthentication("USERNAME","PASSWORD")

    email.setStartTLSEnabled(true)

    email.setSSLOnConnect(false)

    email.setSubject("Subject")

    val emailMsg = EmailMessage(email)

    emailMsg

  }

Upvotes: 2

Views: 153

Answers (0)

Related Questions