# Email getting rejected with 550 Messages should have one or no Content-Type headers, not 2

**URL:** https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067
**Category:** General
**Created:** [12 April 2021 21:33 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067 "2021-04-12T21:33:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)
#### Post date: [12 April 2021 21:33 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/1 "2021-04-12T21:33:38Z")

</div>

Hi,

Over the last week or so I have been getting an error for some emails sent with the email node to an outlook server. I am getting a bounce on the email with

The response from the remote server was:

550 Messages should have one or no Content-Type headers, not 2.

It is quite strange as it seems to work if I trigger the email manually and it worked for over year.

I set up the email by

```auto
let batch_id = msg.batch
let payload = msg.payload //was msh.payload thanks Steve
msg.to = "redacted@redacted.com.au"
msg.bcc = "chrisn@work.com.au,"
msg.topic = "Order Data for Batch ID "+msg.batch
msg.attachments = [{ filename: batch+".csv",
                     content: payload
                  }];

msg.payload = "Attached is the order Data for batch id "+batch

return msg;

```

Before I go an spend to much tiime on this has anyone seen anything like this ?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [12 April 2021 21:55 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/2 "2021-04-12T21:55:23Z")

</div>

> [@chrisn-au](#):
>
> `msh.payload`

Maybe due to the typo?

---

<div class="post-metadata">

### Author: ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)
#### Post date: [12 April 2021 22:01 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/3 "2021-04-12T22:01:50Z")

</div>

unfortunately not, that typo was me sanitising before posting I will tidy up the typo

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [12 April 2021 22:49 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/4 "2021-04-12T22:49:12Z")

</div>

What happens if you put quotes around the email addresses and/or remove the comma?

```auto
msg.to = `"redacted@redacted.com.au"`
msg.bcc = `"chrisn@work.com.au"`

```

---

<div class="post-metadata">

### Author: ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)
#### Post date: [12 April 2021 23:19 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/5 "2021-04-12T23:19:25Z")

</div>

Steve,

Umm, I may have found the issue, (and not sure why it has started to occur now). The upstream flow makes a HTTP call, so msg.headers is set. In my resend flow msg.headers is not set .

I assume that the email node may be using the msg.headers field. I have justed nuked msg and only explicitly set what I need. will find out tomorrow at 7 am but it makes sense

```auto
let batch_id = msg.batch
let payload = msg.payload //was msh.payload thanks Steve
msg.payload = {}
msg.to = "redacted@redacted.com.au"
msg.bcc = "chrisn@work.com.au,"
msg.topic = "Order Data for Batch ID "+msg.batch
msg.attachments = [{ filename: batch+".csv",
                     content: payload
                  }];

msg.payload = "Attached is the order Data for batch id "+batch
``
```

---

<div class="post-metadata">

### Author: ![chrisn-au](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chrisn-au/32/25504_2.png) [@chrisn-au](https://discourse.nodered.org/u/chrisn-au)
#### Post date: [12 April 2021 23:27 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/6 "2021-04-12T23:27:38Z")

</div>

So yep the email node does use msg.headers

```auto
                    if (node.name === "") {
                        sendopts.cc = msg.cc;
                        sendopts.bcc = msg.bcc;
                        sendopts.inReplyTo = msg.inReplyTo;
                        sendopts.replyTo = msg.replyTo;
                        sendopts.references = msg.references;
                        sendopts.headers = msg.headers;
                        sendopts.priority = msg.priority;
                    }

```

So I guess that the receiving sides email server has been upgraded and it justifiably rejects a header like

```auto
msg.headers =
{
        "API-TOKEN": msg.accessToken,
        "Content-Type": "application/json" 
}

```

Thanks for the help

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 April 2021 23:27 UTC](https://discourse.nodered.org/t/email-getting-rejected-with-550-messages-should-have-one-or-no-content-type-headers-not-2/44067/7 "2021-04-26T23:27:41Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
