Since 12 Dec EMAILS CAN'T BE SENT USING THIS TOOLKIT - notifications.sendemail is not supported

Dec 10, 2007 at 9:09 AM
According to the platform status feed "update on email migration" notifications.send will be deleted on Dec 11.

As far as I can see the there is no notication.sendemail in the current toolkit which means no more emails to app users.

.......or does anyone know better ?

KeithT
Dec 10, 2007 at 11:10 PM
I will second that this needs to be done. Gotta love Facebook deciding to change their API on us eh?
Dec 13, 2007 at 3:07 PM
This happened, so any app using this Toolkit can't now send emails to their installed base.

This is serious problem.

Anyone got a patch for this ?

KeithT
Dec 15, 2007 at 2:56 AM
You may download a patch I created at http://www.pixelart.com.sg/upload/Facebook.dll. Use it to replace the one in your Bin folder.

Method signature:
SendEmail(string recipients, string subject, string text, string fbml)

Send a plain text email:
_fbService.SendEmail("111111111", "This is the email subject", "Hello world!", null);

Send a fbml email:
_fbService.SendEmail("111111111", "This is the email subject", null, "Testing link: <a href=\"http://www.google.com/\">Google</a>");
Dec 17, 2007 at 1:13 PM
Hi Lexin,

Many thanks for this, have downloaded and got it working.

It got us out of a hole.

Regards and thanks again.

KeithT
Dec 19, 2007 at 8:34 PM
Edited Dec 20, 2007 at 4:45 PM
Thnx.
Dec 20, 2007 at 10:37 PM

Lexin,

Are you willing to share the source for your patch?

-David
Dec 21, 2007 at 12:18 AM
Hi David, the source files can be found at:

http://www.pixelart.com.sg/upload/FacebookAPI.cs
http://www.pixelart.com.sg/upload/FacebookService.cs

The following were the changes I made to the source code:

(1) Added the send email method after the "SendNotification" method in csharp/Facebook/API/FacebookAPI.cs

/// <summary>
/// Send an email
/// </summary>
/// <param name="recipients">A comma-separated list of recipient IDs. The recipients must be people who have already added your application. You can email up to 100 people at a time.</param>
/// <param name="subject">The subject of the email message.</param>
/// <param name="text">The plain text version of the email content. You must include at least one of either the fbml or text parameters. </param>
/// <param name="fbml">The FBML version of the email. You must include at least one of either the fbml or text parameters. The fbml parameter is a stripped-down set of FBML that allows only tags that result in text, links and linebreaks.</param>
public string SendEmail(string recipients, string subject, string text, string fbml)
{
string results = string.Empty;

Dictionary<string, string> parameterList = new Dictionary<string, string>(5);
parameterList.Add("method", "facebook.notifications.sendEmail");
parameterList.Add("recipients", recipients);
parameterList.Add("subject", subject);
parameterList.Add("text", text);

if (!string.IsNullOrEmpty(fbml))
{
parameterList.Add("fbml", string.Format(_installedCulture, fbml));
}

string xml = ExecuteApiCallString(parameterList, true);
if (!String.IsNullOrEmpty(xml))
{
XmlDocument xmlDocument = LoadXMLDocument(xml);

XmlNodeList nodeList = xmlDocument.GetElementsByTagName("notificationssendEmailresponse");

if (nodeList != null && nodeList.Count > 0)
{
if (nodeList0.HasChildNodes)
{
results = nodeList0.InnerText;
}
}
}
return results;
}



(2) Added the send email method after the "SendNotification" method in csharp/Facebook/Components/FacebookService.cs

/// <summary>
/// Send an email
/// </summary>
/// <param name="recipients">A comma-separated list of recipient IDs. The recipients must be people who have already added your application. You can email up to 100 people at a time.</param>
/// <param name="subject">The subject of the email message.</param>
/// <param name="text">The plain text version of the email content. You must include at least one of either the fbml or text parameters. </param>
/// <param name="fbml">The FBML version of the email. You must include at least one of either the fbml or text parameters. The fbml parameter is a stripped-down set of FBML that allows only tags that result in text, links and linebreaks.</param>
public string SendEmail(string recipients, string subject, string text, string fbml)
{
string results = string.Empty;
if (!IsSessionActive() && IsDesktopApplication)
{
ConnectToFacebook();
}
try
{
results = _facebookAPI.SendEmail(recipients, subject, text, fbml);
}
catch (FacebookTimeoutException)
{
_facebookAPI.SessionKey = null;
if (IsDesktopApplication)
{
ConnectToFacebook();
SendEmail(recipients, subject, text, fbml);
}
else
{
throw;
}
}

return results;
}

(3) Compile project.
Jan 4, 2008 at 4:04 PM
I think a better solution would be to modify the current SendNotification that we were all using so that internally it will send the subject/body to the new sendEmail method.

That way we are not required to change anything at our end.

Any comments?
Apr 7, 2008 at 4:16 PM
Edited Apr 7, 2008 at 4:17 PM
thanks ,
just chekceck that 0 and 0
Apr 15, 2008 at 5:40 PM
Thanks, That works for me! This wiki mangled some of your code around the lines
nodeList[0].HasChildNodes)
{
results = nodeList[0].InnerText;

Note: It takes two braces to disable the wiki's formatting despite what the markup guide says.



Apr 15, 2008 at 5:41 PM
So should I be able to send 1 email to all 30K users of my app at once, or do I have to do it 100 at a time, or spread it over time, or ??? The rules are so confusing...
Apr 25, 2008 at 7:30 PM
Lexin, are you contributing the source for your patch to the project? ie check in the changes, or someone with checkin permissions get his explicit approval, etc
May 1, 2008 at 3:52 PM
I second Shazron's request - Lexin, it would be great if your patch could be integrated into the codeplex version of the code.
May 1, 2008 at 11:01 PM


Lexin wrote:
Hi David, the source files can be found at:
....


Lexin, many thanks for the code - we appreciate your contribution to the project. I tested your code, and it seems others have tested your code, so I added it to the codebase. Thanks again !!
May 2, 2008 at 5:40 AM
gregbalajewicz, thanks for adding the code for me.
Jan 29, 2010 at 6:44 AM
Lexin wrote:
Hi David, the source files can be found at:

http://www.pixelart.com.sg/upload/FacebookAPI.cs
http://www.pixelart.com.sg/upload/FacebookService.cs

The following were the changes I made to the source code:

(1) Added the send email method after the "SendNotification" method in csharp/Facebook/API/FacebookAPI.cs

/// <summary>
/// Send an email
/// </summary>
/// <param name="recipients">A comma-separated list of recipient IDs. The recipients must be people who have already added your application. You can email up to 100 people at a time.</param>
/// <param name="subject">The subject of the email message.</param>
/// <param name="text">The plain text version of the email content. You must include at least one of either the fbml or text parameters. </param>
/// <param name="fbml">The FBML version of the email. You must include at least one of either the fbml or text parameters. The fbml parameter is a stripped-down set of FBML that allows only tags that result in text, links and linebreaks.</param>
public string SendEmail(string recipients, string subject, string text, string fbml)
{
string results = string.Empty;

Dictionary<string, string> parameterList = new Dictionary<string, string>(5);
parameterList.Add("method", "facebook.notifications.sendEmail");
parameterList.Add("recipients", recipients);
parameterList.Add("subject", subject);
parameterList.Add("text", text);

if (!string.IsNullOrEmpty(fbml))
{
parameterList.Add("fbml", string.Format(_installedCulture, fbml));
}

string xml = ExecuteApiCallString(parameterList, true);
if (!String.IsNullOrEmpty(xml))
{
XmlDocument xmlDocument = LoadXMLDocument(xml);

XmlNodeList nodeList = xmlDocument.GetElementsByTagName("notificationssendEmailresponse");

if (nodeList != null && nodeList.Count > 0)
{
if (nodeList0.HasChildNodes)
{
results = nodeList0.InnerText;
}
}
}
return results;
}



(2) Added the send email method after the "SendNotification" method in csharp/Facebook/Components/FacebookService.cs

/// <summary>
/// Send an email
/// </summary>
/// <param name="recipients">A comma-separated list of recipient IDs. The recipients must be people who have already added your application. You can email up to 100 people at a time.</param>
/// <param name="subject">The subject of the email message.</param>
/// <param name="text">The plain text version of the email content. You must include at least one of either the fbml or text parameters. </param>
/// <param name="fbml">The FBML version of the email. You must include at least one of either the fbml or text parameters. The fbml parameter is a stripped-down set of FBML that allows only tags that result in text, links and linebreaks.</param>
public string SendEmail(string recipients, string subject, string text, string fbml)
{
string results = string.Empty;
if (!IsSessionActive() && IsDesktopApplication)
{
ConnectToFacebook();
}
try
{
results = _facebookAPI.SendEmail(recipients, subject, text, fbml);
}
catch (FacebookTimeoutException)
{
_facebookAPI.SessionKey = null;
if (IsDesktopApplication)
{
ConnectToFacebook();
SendEmail(recipients, subject, text, fbml);
}
else
{
throw;
}
}

return results;
}

(3) Compile project.

 Hi Lexin,

I am not able to find ur Facebook.DLL and Facebook.cs,FacebookService classes. I need to send emails by using notifications.SendEmail

Thanks in advance.

Jan 29, 2010 at 7:14 AM

Hi ibrahimkhan I just uploaded the dll file to http://www.pixelart.com.sg/upload/Facebook.dll. Please try again. Sorry I was unable to find the c# source file. You may follow the above code to amend the souce and compile.

Jan 29, 2010 at 8:49 AM
lexin wrote:

Hi ibrahimkhan I just uploaded the dll file to http://www.pixelart.com.sg/upload/Facebook.dll. Please try again. Sorry I was unable to find the c# source file. You may follow the above code to amend the souce and compile.

 Hi Lexin,

Thanks a lot for the Dll. I have one more question- Now facebook3.0 is released.In this notifications.sendEmail() is not working it seems.Early in 2.0 version its working. Do you have any idea about this...

Thanks,

Ibrahim.

Jan 29, 2010 at 9:02 AM
lexin wrote:

Hi ibrahimkhan I just uploaded the dll file to http://www.pixelart.com.sg/upload/Facebook.dll. Please try again. Sorry I was unable to find the c# source file. You may follow the above code to amend the souce and compile.

<font size="2">

_fser.SendEmail(

</font>

"11111111", "test", "test", null);

I am getting error like -  ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment

Thanks,

Ibrahim.