We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 43888
    • 19 Posts
    hi there,
    i'm trying to send email from different smtp with authentication in the same site...
    i managed to do it on my development local machine, calling from a snippet the PEAR Mail.php
    the problem is that my hosting provider doesn't install the PEAR Mail, nor Mime, packages, so i receive this disturbing error: Warning: require_once(Mail.php): failed to open stream: No such file or directory in /htdocs/public/www/modx/core/cache/includes/elements/modsnippet/9.include.cache.php on line 23 Fatal error: require_once(): Failed opening required 'Mail.php' (include_path='.:/usr/share/php:/usr/share/pear') in /htdocs/public/www/modx/core/cache/includes/elements/modsnippet/9.include.cache.php on line 23

    i also need to include attachments in those emails.
    can someone suggest me a way to solve this?
    thanks in advance
    airone
      • 16348
      • 64 Posts
      I think the best way is to use the modMail service and possible write an own implementation class to handle your different smtp servers. Look at http://rtfm.modx.com/display/revolution20/modMail to get some inspiration.
      Is it really necessary to use different mail servers? It looks very complicated.
      PHPMailer can be used to add attachments to emails. The email hook to FormIt is a good example of that.
        • 43888
        • 19 Posts
        Quote from: Kristoffer at Jul 24, 2013, 03:08 AM
        I think the best way is to use the modMail service and possible write an own implementation class to handle your different smtp servers. Look at http://rtfm.modx.com/display/revolution20/modMail to get some inspiration.
        Is it really necessary to use different mail servers? It looks very complicated.
        PHPMailer can be used to add attachments to emails. The email hook to FormIt is a good example of that.

        first, thank you for your answer.
        i can't install PHPMailer on the hosting server, and i have to use different smtp when i send different kind of mails... i have no choice sad
          • 16348
          • 64 Posts
          You don't have to install PHPMailer, it is included in the modx package.
            • 43888
            • 19 Posts
            ok, now i managed to send email with different smtp params, creating a custom hook to handle mails using phpmailer.

            now i have another problem: if i use the recaptcha hook, i would expect that if i don't pass the captcha, the form submission would not send the email but it actually does.

            am i forgetting something? i tried to understand where formit manages errors in filling the captcha, but i had no luck.
            any suggestion?

            as soon as i've fixed the hook i'll post it here.
            thanx again
              • 16348
              • 64 Posts
              Do you have the recaptcha hook before your custom hook in the snippet call? The hooks are processed in the order they are written in the snippet call.
                • 43888
                • 19 Posts
                actually i found out by myself around 3 minutes ago reading http://codingpad.maryspad.com/2011/03/08/modx-revolution-for-complete-beginners-part-9-using-formit-for-contact-forms/... now i'm planning to hang myself!

                thank u the same, i hope in a few days to post my custom hook