Closed julbrs closed 9 months ago
I am also seeing this issue
I also see the same problem with setting the Sender
header.
const message = createMimeMessage();
message.setHeader("Sender", "test@example.com");
When setting "Sender", it is validating if the value is an instance of a Mailbox
. When I try to import Mailbox
however
import { createMimeMessage, Mailbox } from "mimetext";
I can only import the Mailbox interface
but not the class, so I cannot call the Mailbox
constructor to create a Mailbox.
Inspired by @yukikywong, this idea comes up to me:
message.setHeader("Reply-To", createMimeMessage().setSender("test@example.com"));
where setSender
just returns a Mailbox
instance.
It does work well even though be tricky.
@Gowee This seems to be a working solution for now.
A dedicated message.setReplyTo({ name: ..., addr: ... })
would be more elegant though.
Inspired by @yukikywong, this idea comes up to me:
message.setHeader("Reply-To", createMimeMessage().setSender("test@example.com"));
where
setSender
just returns aMailbox
instance.It does work well even though be tricky.
yo what? how did you even come up with this, this is smart hahah
sorry for the delay, im taking care of it right now
hey again, the Reply-To
header is specially handled by the lib and proper way to add it is by creating an instance of Mailbox
: msg.setHeader('Reply-To', new Mailbox('asd@asd.com'))
as its just become available as of version v3.0.19. you have to import the Mailbox
class: import { createMimeMessage, Mailbox } from 'mimetext'
. closing this issue as it should all be resolved, open again if you face any problems.
Hi,
It seems that we are struggling to add a "Reply-To" header (which is different from the "From" header). What is the best way to define a "Reply-To"?
generate the following message:
Thanks!