We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37434
    • 12 Posts
    I'm using FormIt to send emails and it isn't working... but I'm not convinced it's FormIt's fault.

    FormIt chunk:
    [[!FormIt?
    &hooks=`spam,email,redirect,FormItAutoResponder`
    &redirectTo=`66`
    &emailTpl=`ServiceFormReport`
    &emailTo=`[[++emailsender]]`
    &emailUseFieldForSubject=`1`
    &fiarFrom=`[[++emailsender]]`
    &fiarTpl=`ServiceFormReport`
    &fiarSubject=`auto response`
    &submitVar=`submitContact`
    ]]

    I ran QuickEmail in debug mode and got the following results:
    System Settings (used if property is missing):
    emailsender System Setting: [email protected]
    site_name System Setting: Destructive Customs
    Properties (from parameters, property set, or snippet default properties:
    Tpl chunk name:
    subject:
    to:
    fromName:
    replyTo:
    emailSender:
    allowHtml: 1
    message:
    Final Values (actually used when sending email):
    subject: Default Subject
    to: [email protected]
    fromName: [email protected]
    replyTo: [email protected]
    emailSender: [email protected]
    allowHtml: 1
    Message Body: Default Message
    Send reported successful

    I didn't get an email though, and nothing came up in my spam folder.

    I tried this as well in a snippet:
    mail('[email protected]', 'test', 'test')

    ...and nothing happened. Now the weird thing is that the auto responder hook in the above FormIt snippit WORKS. So, does anyone have some ideas on why regular email sending mechanisms don't seem to work, but auto responder does?
      • 3749
      • 24,544 Posts
      Have you tried setting the SMTP system settings and using your host's SMTP server?


      ---------------------------------------------------------------------------------------------------------------
      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
      MODX info for everyone: http://bobsguides.com/modx.html
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 37434
        • 12 Posts
        Ok, so this problem is PROBABLY mail server related. Regardless of method, there just seem to be some addresses that neither MODx, nor php can send mail to. I imagine there might be some problems with the receiving server thinking that my messages are forged. So I set my SPF DNS settings correctly, but no joy. Here is what I did to overcome it:

        1) Sign up for google apps (if you search online, there is a link for up to 10 accounts free for a lifetime, not just the standard 30 days).
        2) Set up my SPF settings to recognize that google is a valid sender
        3) Download PHPMailer
        4) Write a custom snippet to use google's smtp server.

        I'll post up my code as soon as I get done with #4 and I've had ample enough time to test it with multiple email addresses. I have a hard coded version that proves proof of concept though. If I have enough time, I may even make this my first contributed package. wink
          • 37434
          • 12 Posts
          So I feel like a moron now. I thought to myself "Self, wouldn't it be great if I just integrated these new settings into the core of the site, so ALL the email methods would work?"

          So... I start browsing through the core... and think to myself "this code looks awfully like the package I just downloaded... and look, it's calling the database for default values." So I start to look through the system settings, and see the front end options for all those db calls. So not only was the code suspiciously similar to the package I was messing with, but there were easy to set options in system settings to set it up EXACTLY the same way I had previously hard coded it.

          Right about then, I started hitting myself on the head with a shovel.