# SMTPClient: Format mail body

**URL:** https://discourse.julialang.org/t/smtpclient-format-mail-body/39818
**Category:** New to Julia
**Created:** [May 20, 2020, 10:03am UTC](https://discourse.julialang.org/t/smtpclient-format-mail-body/39818 "2020-05-20T10:03:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![uwechsler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uwechsler/32/5223_2.png) [@uwechsler](https://discourse.julialang.org/u/uwechsler)
#### Post date: [May 20, 2020, 10:03am UTC](https://discourse.julialang.org/t/smtpclient-format-mail-body/39818/1 "2020-05-20T10:03:25Z")

</div>

Is there a way to format the content of an email in `SMTPClient.jl` with HTML tags or in another way?  
For example by using this [example](https://github.com/aviks/SMTPClient.jl) but with additional `<b>` tags

```julia
body = IOBuffer(
  "Date: Fri, 18 Oct 2013 21:44:29 +0100\r\n" *
  "From: You <you@gmail.com>\r\n" *
  "To: me@test.com\r\n" *
  "Subject: Julia Test\r\n" *
  "\r\n" *
  "Test Message: <b>Important </b>\r\n")

```

---

<div class="post-metadata">

### Author: ![pixel27](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pixel27/32/8902_2.png) [@pixel27](https://discourse.julialang.org/u/pixel27)
#### Post date: [May 20, 2020, 12:16pm UTC](https://discourse.julialang.org/t/smtpclient-format-mail-body/39818/2 "2020-05-20T12:16:07Z")

</div>

Not sure what you mean by additional B tags, there is one in that message, it might work, it might not, you can add more and they might work or might not. I really depends on the client. Email is just text. It’s up to the client to decide how to display that text.

What mostly works is writing an actual HTML page in the body of the email, so if you did something like:

```julia
"""
<html>
    <head>
        [Define CSS and whatever.]
    </head>
    <body>
         [Enter the body of the message.]
    </body>
</html>
"""

```

One thing when writing HTML for email clients, you need to write it like it’s the 90s and use tables to do all your layout. Some email readers have never gotten with the times and fully embraced CSS.

You best bet is googling for “HTML email templates” and start with one of those and edit it for yourself.

---

<div class="post-metadata">

### Author: ![uwechsler](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/uwechsler/32/5223_2.png) [@uwechsler](https://discourse.julialang.org/u/uwechsler)
#### Post date: [May 20, 2020, 12:57pm UTC](https://discourse.julialang.org/t/smtpclient-format-mail-body/39818/3 "2020-05-20T12:57:48Z")

</div>

Thank you!! With your help and looking for _HTML email templates_ it worked.

I had to add `"\r\n"` add the end of each element to obtain the working example

```julia
body = "Subject: A simple test\r\n"*
    "Mime-Version: 1.0;\r\n"*
    "Content-Type: text/html;\r\n"*
    "Content-Transfer-Encoding: 7bit;\r\n"*
    "\r\n"*
    """<html>
    <body>
    <h2>An important link to look at!</h2>
    Here's an <a href="https://github.com/aviks/SMTPClient.jl">important link</a>
    </body>
    </html>\r\n"""

```

Btw: With additional b-tag, I meant that in `SMTPClient.jl` there is no example that has HTML tags, e.g. a b-tag and I wanted to make this work.
