Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
As explained by manassehkatz, the message (aka the body) is a text in PHP (and many other programming languages). If your e-mails have a certain structure, you should create a function that takes ...
Answer
#1: Initial revision
As explained by manassehkatz, the message (aka the body) is a text in PHP (and many other programming languages). If your e-mails have a certain structure, you should create a function that takes that structure (i.e. your array) and generate a string from it. This is a good idea also from an architectural point of view because separating body construction from the actual e-mail sending functionality is preferred. Also, you should take care of the message format (plain text vs. HTML) as it might involve some changes (e.g. using `<p>`s or `<br>`s instead of newlines).