Skip to content
Advertisement

Can we use multiple message fields in wp_mail() function?

I have a code in php and i want to use that code in my wordpress website. I have created a contact form included some field calculations (multiplication/addition) on the client side. But after the user fills the form, user submit the form for mail processing.

I am using wp_mail() function to receive mail from user. But the problem is that, i have multiple fields and the wp_mail function accepts only

JavaScript

I have following for example:

JavaScript

I am confused how wp_mail() will send all this information via mail. Is there a way to to send all this data using wp_mail() or any other option?

Full Code.

JavaScript

Advertisement

Answer

You can build up the message part by doing something like this:

JavaScript

Don’t forget to do your validation, anti spam checking etc before you send the email!

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement