Send email using PHP SDK

(Timothy Jensen) #1

I’m wondering why this returns false?


$contact_id = $infusionsoft->contacts( 'xml' )->addWithDupCheck( $contact, 'Email' );

$response = $infusionsoft->emails( 'xml' )->sendEmail( [ $contact_id ], '', 
$user->data->user_email, '', '', 'HTML', 'Message Subject', "HTML content", "Text content" );

// I'm getting a valid email, Infusionsoft contact ID, but the email response is `false`
var_dump( $user->data->user_email, $contact_id, $response );

(John Borelli) #2

Have you tried to do this with a template id as well?

(Timothy Jensen) #3

No, not yet. I’ll give that a try tomorrow and report back. Thanks.

(Timothy Jensen) #4

I added a template ID '145', and tried both Text, and HTML content types. Still no luck.

(Jon Smith) #5

Is the email address in a marketable status inside of Infusionsoft?

(Timothy Jensen) #6

That was it, Jon! I’m trying to send the contact an email after they submit a form, so I guess I need to opt-in the contact via the API then send the e-mail.

(Jon Smith) #7

Correct the flow in this instance would be

  • Add Contact
  • Opt in Email
  • Send email