I’m trying to attach a resume pdf to an email that sends to our client when a user submits a careers form on their website. I’m using the EZ Forms plugin with Sendinblue as the provider. Any direction on how to accomplish this would be wonderful. I’ve tried altering the EZ Forms plugin and just directly using Sendinblue’s API, but to no avail.
Here is my form component.
const FormTwo = () => {
const [fName, setFName] = useState('')
const [lName, setLName] = useState('')
const [email, setEmail] = useState('')
const [phone, setPhone] = useState('')
const [resume, setResume] = useState('')
const [message, setMessage] = useState('')
const [submitted, setSubmitted] = useState(false)
const [bot, setBot] = useState(true)
const submitFormTwo = async () => {
let form = {
"Submission Info": "<br /><br />",
"First Name": `${fName}<br \/>`,
"Last Name": `${lName}<br \/>`,
"Email": `${email}<br \/>`,
"Phone": `${phone}<br \/>`,
"Message": `${message}<br \/>`
}
fetch(`${URL}/ezforms/submit`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ formData: form, formName: 'Careers Form' }),
formData: form,
})
.then((response) => response.json())
.then((data) => console.log(data))
setSubmitted(true)
}
if (submitted) {
return (
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<h3>Thank you! We'll be in touch shortly.</h3>
</div>
)
}
return (
<form onSubmit={submitFormTwo} method='POST'>
<div className={styles.formLeft}>
<input type='text' name='fName' placeholder='First Name' onChange={(e) => setFName(e.target.value)} required />
<input type='email' name='email' placeholder='Email' onChange={(e) => setEmail(e.target.value)} required />
<textarea placeholder='Message/Explanation (optional)' onChange={(e) => setMessage(e.target.value)}></textarea>
</div>
<div className={styles.formRight}>
<input type='text' name='lName' placeholder='Last Name' onChange={(e) => setLName(e.target.value)} required />
<input type='tel' name='phone' placeholder='Phone' onChange={(e) => setPhone(e.target.value)} required />
<input className={styles.fileUplaod} type={'file'} name='resume' onChange={(e) => setResume(e.target.files[0])} required />
<Captcha sitekey={process.env.V_TWO_SITE_KEY} onChange={() => setBot(!bot)} />
<button className={styles.btn2} type='submit' disabled={bot}>
Submit
</button>
</div>
</form>
)
}