#1 June 27, 2015 7:34am

florianuhlemann
Member
From: Germany
Registered: June 26, 2015
Posts: 21
Website

How to implement sendEmail() correctly?

I've stumbled upon another difficulty I can't seem to figure out myself.

I have implemented a few custom lines of php code in a page-template that is supposed to send an email when called.

When just calling the function sendEmail() it results in an error that this function is unknown.

Doing BigTree::sendEmail() goes a step further but breaks again with no email being sent. How do I know it's using my configured Mailgun-account?

Offline

#2 June 27, 2015 9:27am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: How to implement sendEmail() correctly?

To send mail through Mailgun you need to use the BigTreeEmailService class:

<?php
    $service = new BigTreeEmailService;
    $service->sendEmail($subject,$html_body,$to,$from_email,$from_name,$reply_to,$plain_text_body);
?>

Offline

#3 June 27, 2015 9:39am

florianuhlemann
Member
From: Germany
Registered: June 26, 2015
Posts: 21
Website

Re: How to implement sendEmail() correctly?

Thanks Tim. Works! The only reference to functions is under the "Core" and "BigTreeModule", etc? right? Or is there another document I've been missing?

Sorry for so many questions. I'm not an expert in PHP, but learning with a very steep curve here ?

Offline

#4 June 27, 2015 9:41am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 978

Re: How to implement sendEmail() correctly?

You're right, it looks like some of the class documentation isn't in the main site. I'll try to get those missing classes up soon. The main class documentation is here:
https://www.bigtreecms.org/docs/code/

It seems to be a bit outdated and has some things in the wrong category at the moment.

No problem with the questions, happy to help!

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.