We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6408
    • 58 Posts
    Hi Im going mad with frsutratin over this.

    My client is using fasthosts (seem to be notoriously difficult to configure to use email) - and Im using Modx Revo. Basically I have tried using both FormIt and SPForm to send email - I have got further with Spform but I cant send email through a contact form with either of them.

    I suspect its because to send email through a webserver with fasthosts, you need to add ’-f’ parameter. i also think I need to use smtp to send the mail.

    So, for every instance of:

    mail($email_to, $email_subject, $email_message, $headers);


    mail($email_to, $email_subject, $email_message, $headers, '-f'.$email_from);


    My question is, where do I start? are there likely to be files in Spform I need to adjust to add this parameter?

    And what about class.phpmailer.php - found in \core\model\modx\mail\phpmailer

    Do these snippets over-ride these settings? and does the modx manager (system settings) over-ride these settings? If i wanted to force smtp, what would I need to change.

    But most importantly, how can i add this ’-f’ parameter to the send mail variables?

    Any help, please! would be gratefully received, and will get my client to donate to the modx project!

    Many thanks.

    Dan
      • 3749
      • 24,544 Posts
      If you use SMTP, you shouldn’t need the -f. Just set the SMTP system settings and you should be good to go. Don’t use the FormIt or SPform SMTP parameters, that will just confuse the mailer -- use only the MODx System Settings.
        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
        • 6408
        • 58 Posts
        Many thanks for the reply Bob - for anyone who is struggling to get SMTP mailing working because of a server authentication or whatever - here is how I go the snippit formIt to work - I imagine this would be just as straightforward with spForm, too.

        The key for me was actually simple - make sure you include an &emailFrom parameter (in formit) and an email address (an email that is related to your server) in your snippet call - this way the receiving mail server will authenticate the sent message against the ’&emailFrom’ email address. As I said, pretty straight forward. I also included the &smtpEnabled parameter, but not sure how important that is....


        Here is the snippet call I used to get formIt to process the mail - Im sure SPform works just as well with the correct snippet calls - it just so happens that formit worked for me first after trying to get both to work!) as long as you include a ’&emailFrom’(formit) address in the snippet call too. its probably wise to send a subject line across, as spam filtering might stop you receing your mail:

        [[!FormIt? &hooks=`spam,email,redirect`&emailTpl=`MyEmailChunk`&emailTo=`[email protected]` &emailFrom=`from.youemailaddress.com` &redirectTo=`15`&smtpEnabled=`1`&emailUseFieldForSubject=`1` ]]

        as Bob says, enable SMTP authentication in the ’mail’ section of the ’system settings’ and leave it to modx to handle the smtp, not the snippets.

        Hope that helps...