0

I am new to mandrill and am using mandrill to send emails in my React application. Also, I've registered my domain in mandril. I've read the documentation but I can't find it.

deta utama
  • 669
  • 5
  • 14

1 Answers1

0

You can use this code as reference:

import { useEffect} from 'react'


const Checkout = () => {
  useEffect(() => {
    const requestOptions: RequestInit | undefined = {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        key: 'YOUR_API_KEY',
        message: {
          text: 'Example text content',
          subject: 'example subject',
          from_email: 'example@gmail.com',
          from_name: 'Example name',
          to: [
            {
              email: 'example@target.com',
              name: 'Example target name',
            },
          ],
        },
      }),
    }
    fetch('https://mandrillapp.com/api/1.0/messages/send.json', requestOptions).then(
      async (response) => {
        const res = await response.json()
        console.log(res)
      }
    )
  }, [])

  return (
   <h1>Hello</h1>
  )
}

export default Checkout

deta utama
  • 669
  • 5
  • 14