tags:

views:

780

answers:

1

I'm trying to send an email through the Facebook API. I've added the application and given it the email extended permission. I've been following the instructions at http://wiki.developers.facebook.com/index.php/Notifications.sendEmail and am using their sample code (albeit with correct userids in place of the ones they list):

$uids = array(12345,67890,13579);
$csv = implode(",", $uids); 
$result=$facebook->api_client->notifications_sendEmail($csv,"Test: this should appear in the subject", "This should appear in the body (plain text)", "Test: <b><i><u>this should appear in the body</u></i></b> (HTML)");
echo "sent to $result targets of ". count(str_getcsv("$csv",",")) . "total.";

The api call returns no errors, but $result is empty indicating none of the emails were sent (confirmed by the emptiness of my inbox). I have tried this in and out of sandbox mode. Asking facebook for contact_email, proxied_email, and email, all return correct results. Attempting to send an email to the address returned by proxied_email does NOT result in an email being received.

I've also tried sending normal notifications and adding news items to the dashboard, both of those work without problem. I'm not sure what application setting or configuration I am missing. Any suggestions for troubleshooting would be very much appreciated.

+1  A: 

Facebook is transitioning away from the ability to send emails via an API call on Mar. 1st. To compensate, they allow apps to now ask for a user's email address directly.

If you set the email domain in your app's settings, then asking for the email extended permission gives you the users email address instead the ability to send an email via the API.

As of Mar. 1, the API will stop working and you are left alone to figure out your own email solution. This goes for regular notifications, both user to user and app to user, as well

Mike Sherov
Are you sure that is the case? I am aware they are transitioning away from notifications but I was unaware they would also be removing the ability to send emails through the API. http://wiki.developers.facebook.com/index.php/Notifications.send does indicate that Notifications.send is deprecated but http://wiki.developers.facebook.com/index.php/Notifications.sendEmail has no such warning for Notifications.sendEmail.
LogicWolfe
http://forum.developers.facebook.com/viewtopic.php?pid=200634 provided some more information regarding this. Seems you are correct though it doesn't seem to be well documented. Thanks for getting me off of the wrong course.
LogicWolfe

related questions