Does anyone know of a way to send simple php mail from a twig template?

Something we can use like... {% mail 'Message', entry.userEmail %} or similar.

Would be good to not have to pre-define the content in a plugin.

  • Although not what the user was looking for, take a look at my answer here. Is that what you are trying to do? I can provide a better answer here if so...
    – Damon
    Dec 15 '15 at 20:51

You could create a simple plugin with just a Template Variable that sends the mail: https://craftcms.com/docs/plugins/variables

Not sure if I'd put this kind of logic in templates though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.