Formatting form submission email

Hi there! I have successfully created a custom form. When a user submits their content, it is emailed to me using sendgrid and the recommended email.jsw and sendGrid.js modules. This all works great!

The issue I’m having is in formatting the text within the email, such as having the question labels in bold text, with the answers not bold. Forgive me if this is a SUPER obvious answer, but I’m very new to Java. How do I format my text within the email?

Here’s an example of the code I’m talking about. If I wanted just the first input value (the person’s name) and the line, “What is the issue you’re having?” in bold, how would I do that?

import {sendEmail} from ‘backend/email’;
$w.onReady(function () {
$w(“#contactformDataset”).onAfterSave(sendFormData);
});
function sendFormData() {
const subject = New Campaign Reach from ${$w("#nameInput").value};
const body = Name: ${$w("#nameInput").value} \rEmail: ${$w("#emailInput").value} \rPhone: ${$w("#phoneInput").value} \rCompany: ${$w("#companyInput").value} \rWhat is the issue you're having? \r${$w("#messageBox").value} \rNeeds: ${$w("#lookingFor").value};
sendEmail(subject, body)
.then(response => console.log(response));
}

Hi,
We have a new feature that will help you design your Emails much easily. Check out these articles:

There’s also this video tutorial which can be useful:

Good luck :slight_smile:
Tal.

Thanks Tal! So I’ve gotten most of the way there, however the form I’m creating does not rely on a user being logged in on my site. I just want the results to be emailed to me.

It looks like the code relies on the user being logged in to get their email address. How do I alter this top section so that it just sends the email to the same address every time?

import wixUsers from ‘wix-users’;

$w.onReady(function () {
$w(“#dataset1”).onAfterSave( () => {
if(wixUsers.currentUser.loggedIn) {
const userId = wixUsers.currentUser.id;

  wixUsers.emailUser("EMAILID", userId, {

Hey,
You can use the SendGrid API for that purpose. Click here to learn more about it.

Best,
Tal.

Hey Spence, did you ever figure out how to do this? If so, would you please share?