/// <summary>
/// Sends an email message based on given arguments. This email sending method
/// uses the email sending facility of your very server and it does not use any
/// external web services at all. It uses "localhost" to be the name of the SMTP
/// host.
/// </summary>
/// <returns><c>true</c> if mail sending succeeded, <c>false</c> if mail sending failed.</returns>
/// <param name="toEmail">To email.</param>
/// <param name="toName">To name.</param>
/// <param name="fromEmail">From email.</param>
/// <param name="fromName">From name.</param>
/// <param name="subject">The subject.</param>
/// <param name="message">The message.</param>
/// <param name="isHTML">if set to <c>true</c> The message will be treated as Html message otherwise it will be treated as plain text message.</param>
public static bool SendEmail(string toEmail, string toName, string fromEmail, string fromName, string subject, string message, bool isHTML)
{
MailAddress myToAddr = new MailAddress(toEmail, toName);
MailAddress myFromAddr = new MailAddress(fromEmail, fromName);
MailMessage myMessage = new MailMessage(myFromAddr, myToAddr)
{
Subject = subject,
Body = message,
IsBodyHtml = isHTML
};
SmtpClient myClient = new SmtpClient("localhost")
{
Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
};
try
{
myClient.Send(myMessage);
return true;
}
catch
{
return false;
}
}
About the Reason Code, you can cehck the real Reason Code string posted by PayPal by exploring the associated ipn variable with the property PostedData (NameValueCollection). Also you can see the whole IPN string by e.IPN.DecodedRawData. You can ask the SandBox specific questions to PayPal support team as issue could be related with your SandBox account.