Contact From MisBehaving

Brent Hardinge's Avatar

Brent Hardinge

29 Nov, 2011 05:36 AM

I have a from that I setup. It looks great, and seems to work, however it doesn't work correctly. When I submit something, it sends two emails to the email address that submitted the from, not the one that is listed on the notification list. And it is not just a confirmation email. It is the email that should be going to the people on the notification list. This is from a new browser window that is not logged in.

Any ideas>

  1. 1 Posted by Rick on 29 Nov, 2011 07:57 PM

    Rick's Avatar

    I am not getting duplicates, but I have three contact forms, and they are going to sender, not the subscriber. I tested several combinations of senders and recipients, and the subscriber email always go to the inquiree email.

    The "reply to" feature in the "Manage Inquiries" panel works as expected.

    Please advise on how to send the inquiry notices to the subscriber. Thanks.

    Contact Forms 1.0.10
    MT Pro 4.37

    Rick

  2. 2 Posted by Rick on 30 Nov, 2011 03:07 PM

    Rick's Avatar

    Just found this in the source of the contact form

    <p>Or you may contact us via email by using the form below:</p>
    <script type="text/javascript" src="http:/test.countrydayschools.org/mt-static/plugins/ContactForms/js/blog.js"></script>
    

    Notice the missing forward slash in the URL. That will cause a problem.

  3. 3 Posted by Rick on 30 Nov, 2011 03:19 PM

    Rick's Avatar

    Yes, the "Show HTML" button of the Contact Forms panel generates the malformed link to blog.js. Easy to fix on my end. Please fix this in the plugin code.

  4. 4 Posted by Rick on 30 Nov, 2011 04:01 PM

    Rick's Avatar

    The URL correction didn't help. Still the same problem with inquiree receiving the subscriber email.

  5. Support Staff 5 Posted by Jay Allen on 30 Nov, 2011 05:45 PM

    Jay Allen's Avatar

    Hey Rick, thanks for writing. I'll see if I can take a look at this today.

  6. 6 Posted by Rick on 01 Dec, 2011 02:50 PM

    Rick's Avatar

    I'm looking at ContactForm/App/Inquiries.pm

        my $inquiry = MT->model('contact_form_inquiry')->new;
        $inquiry->blog_id( $app->blog->id );
        $inquiry->form_id( $form->id );
        $inquiry->subject( $q->param('subject') );
        $inquiry->text( $q->param('body') );
        $inquiry->status( MT->model('contact_form_inquiry')->UNREAD() );
        if ($commenter) {
            $inquiry->from_author( $commenter->id );
        }
        $inquiry->from_name($nick);
        $inquiry->from_email($email);
        $inquiry->junk_status(0);
    
        $inquiry->load_meta_fields();
    

    Then later in sub _send_inquiry_notification:

        my ( $form, $inquiry, $subscriber ) = @_;
        # snippped        
        my %head = (
            id => 'inquiry_notification',
            To => $inquiry->from_email,
            $from_addr ? ( From       => $from_addr ) : (),
            $reply_to  ? ( 'Reply-To' => $reply_to )  : (),
            Subject => $subject,
        );
    

    We're sending to the from_email, which I think is the email that the inquiree puts in the 'email' field. I think we should be getting the To email from the subscriber parameter. But the $subscriber variable is never used, in the entire module. How do you get the subscriber email from the $subscriber variable?

  7. 7 Posted by Rick on 01 Dec, 2011 03:21 PM

    Rick's Avatar

    Yes, I changed:

        To => $inquiry->from_email,
    

    to

        To => $subscriber,
    

    And it seems to work properly now.

  8. 8 Posted by Rick on 01 Dec, 2011 03:30 PM

    Rick's Avatar

    When I reply via the contact forms web panel, the reply is sent to the inquiree (good) and all the subscribers. I guess that is the intended behavior. So then I hope it is all worked out and we can expect Contact Forms 1.0.11 very soon.

    Thanks for the great software!

  9. 9 Posted by Brent Hardinge on 04 Dec, 2011 02:10 AM

    Brent Hardinge's Avatar

    Thank Rick for looking into this. I'm by no means an expert in MT and am struggling with this. I tried the change you suggested and ended up with the following error:

    failed loading package ContactForms::App::Inquiries for routine ContactForms::App::Inquiries::cf_post: Global symbol &quot;$subscriber&quot; requires explicit package name

  10. 10 Posted by Rick on 04 Dec, 2011 08:20 PM

    Rick's Avatar

    I'm using the most current Contact Forms version 1.0.10 . So that may matter. Also, make sure that you substitute $subscriber only once, and only within the _send_inquiry_notification block of code, which is the last block of code in App/Inquiries.pm (line 525 in version 1.0.10).

    You have appeared to make the substitution much further up in the module.

    Reinstall the module with the latest version and make that substitution.

    BTW, that error happens when you call a variable without having declared a "my $subscriber" within the same block or subblock (the same scope). Since $subscriber is declared (with my) in the _send_inquiry_notification block:

    my ( $form, $inquiry, $subscriber ) = @_;
    

    Then you should not get the "requires explicit package name" error when you use $subscriber later within the same block.

    I've attached my modified App/Inquiries.pm file, but use this only with the same version, or to compare (line 525) against your version.

  11. 11 Posted by Brent Hardinge on 04 Dec, 2011 09:22 PM

    Brent Hardinge's Avatar

    Thank you, Thank you, Thank you Rick! That did the trick. I'm glad to see that I'm not the only one with this issue and that at least someone can read through Perl better than I can! I changed back the first section and now I'm back in business!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac