Change CAPTCHA case sensitivity for SendMail

8 posts, 0 answers
  1. Bill
    Bill avatar
    13 posts
    Member since:
    May 2011

    Posted 15 Feb 2012 Link to this post

    How do we change the case sensitivity for the CAPTCHA when using the SendMail SocialNetType? When presented to end-users, there is no notification about case sensitivity and they could potentially get frustrated because the CAPTCHA error returns "Please, reenter the code in the captcha", even though the code IS entered in correctly, but in lowercase.
  2. Bill
    Bill avatar
    13 posts
    Member since:
    May 2011

    Posted 15 Feb 2012 Link to this post

    Not sure what was going on, but this appears to be working now with lowercase or uppercase. However, I hope in future releases there will be a way for us to debug and step through the SendMail process, as for right now it just returns a generic "Oops!" error and there's really no telling where the error is generated from. I'm trying to send mail through GoDaddy's "relay-hosting.secureserver.net", which is set in my web.config. I can send just fine through my other email pages, but the SocialMail does not work. I've even tried setting the SMTP through the EmailSetting innertag. Still no luck.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 16 Feb 2012 Link to this post

    Hi Bill,

    The RadCaptcha is, by default, case-insensitive. It is possible that the confusion stems from the similarity between the letter "O" and a zero (digit). Nevertheless you can access the RadCaptcha in the code-behind and set its IgnoreCase property to false with the following code:
    ((ssh1.FindControl(ssh1.ID + "_emailPopup") as RadWindow).ContentContainer.Controls[0].FindControl(ssh1.ID + "_captcha") as RadCaptcha).IgnoreCase = false;

    Where ssh1 is the ID of the RadSocialShare control on the page.

     As for your e-mail issue - generally debugging compiled code is not possible, i.e. you cannot debug the send e-mail's code-behind. You can, however, read the error by examining the response from the server (see attached screenshot). If more such requests come in we will consider exposing an event that will offer the server error in its arguments. On your exact issue - currently my best guess is that the SMTP server is not properly set in the properties - you can test the casing, protocols and domains for the server you set to the SMTPServer property. By also examining th error messages you should be able to get this working. We use the standard .NET classes for working with web mail, so if the server is properly configured it should accept the message.

    All the best,
    Marin
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Bill
    Bill avatar
    13 posts
    Member since:
    May 2011

    Posted 17 Feb 2012 Link to this post

    Hello Marin,

    First of all, thanks for the quick reply and information you provided. Using Firebug, I narrowed the error message down to this...

    eThere was an error in the callback.s

    I'm still not sure what the issue is. I made sure my smtp settings were correct. I will keep plugging away at this and hopefully find a solution.

    Thanks!
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 21 Feb 2012 Link to this post

    Hi Bill,

    I have searched through our code and we do not throw such an exception. In fact, this string does not exist in our code at all. What I can assume right now is that it comes from the callback function of the mail server and we simply capture it and send it onward. In our method we use the standard .NET classes MailMessage and SmtpClient to send the mail, so if the server is configured to accept them there shouldn't be an issue.


    Regards,
    Marin
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 03 Jun 2013 Link to this post

    I am also getting the following error:

    eThere was an error in the callback.72|/wEWAwKtw46LCQKj57TZAgKj0a6dCyzrhqYE8pxCNDcBsmzFDBcmKxg7jvVrH+6Uk2laFL/A
    I am using the inline settings

    <telerik:RadSocialShare runat="server" ID="RadSocialShare2" UrlToShare='<%# ((DataRowView)Container.DataItem)["UrlToShare"] %>'>
                <EmailSettings FromEmail="info@mydomain.com" SMTPServer="mail.mydomain.com"
                    UserName="info@mydomain.com" Password="passhere"></EmailSettings>
                <MainButtons>
                    <telerik:RadSocialButton SocialNetType="SendEmail"></telerik:RadSocialButton>
                </MainButtons>
            </telerik:RadSocialShare>

  8. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 06 Jun 2013 Link to this post

    Hi Marty,

    It seems that the error message comes from the callback function of the mail server as a string with such text does not present in our code. As my colleague has already said we use the standard .NET classes to send mails:

    You can also find below the exact code that takes its parameters from the sendEmail dialog:

    private void SendMail(string from, string to, string subject, string body)
    {
        MailMessage mail = new MailMessage();
        mail.IsBodyHtml = true;
        mail.From = new MailAddress(from);
        mail.Sender = new MailAddress(_emailSettings.FromEmail);
        string[] recepients = to.Split(',', ';');
        //check if empty - in case of additional , or ;
        foreach (string recepient in recepients) if (recepient != string.Empty) mail.To.Add(new MailAddress(recepient));
        mail.Subject = subject;
        mail.Body = body;
        string smtpServer = EmailSettings.SMTPServer;
        SmtpClient smtp = smtpServer != String.Empty ? new SmtpClient(smtpServer) : new SmtpClient();
        if (EmailSettings.UserName != String.Empty && EmailSettings.Password != string.Empty) smtp.Credentials = new System.Net.NetworkCredential(EmailSettings.UserName, EmailSettings.Password);
        else smtp.UseDefaultCredentials = true;
        //smtp.Credentials = new System.Net.NetworkCredential();
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.Send(mail);
      
    }

    As you can see this is a default e-mail message and we cannot controls whether the server rejects it.

    What you can try is providing the full URL to the server, including the port to see if the new SmtpClient(smtpServer) constructor can read the protocol and ports from it, e.g. SMTPServer="https://smpt.mydomain.com:PORT/" but I cannot guarantee this will work. We simply pass the string and the rest is done by the framework.

    What else you can consider is creating a custom form for this and have it in a RadWindow (form fields, captcha and post button that will execute your own code-behind to send the mail). You can do this by using the OnSocialButtonClicking event with the following code:

    function OnSocialButtonClicking(sender, args)
    {
        if(args.get_socialNetType() == "SendEmail"){
            args.set_cancel(true);
            //open custom form
        }
    }

    You can also vote for this feedback item that would allow using a third party API for sending emails in RadSocialShare.


    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  9. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 06 Jun 2013 Link to this post

    Danail,

    thanks I am checking it out now

    Marty
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017