</> Developers Guide to Funraisin

Emails

Technology

All emails sent from a Funraisin site are sent via MailGun via a secure server side API call.

In order for us to be able to send emails we require permission in the form of 3 key DNS settings on the primary domain which are:

SPF Record
In the form of a TXT record

Domain Keys
In the form of a TXT record

MX Record

A single platform can only send emails on behalf of 1 domain name but you can control the following

From name
This is the name that the end user sees in their INBOX

FROM email
This generally needs to be the same domain as what is set in the above DNS records, if it is changed to a different domain then you risk affecting deliverability.

REPLYTO email
This is the email address used if the end user decides to reply to an email. This address can be any email address on any domain, it doens't need to be one we have permissions to send on behalf of.

Email Types

Emails sent from a Funraisin site generally fall into 1 of 3 categories.

Transactional (Automated) Emails
These are also referred to as Automated Emails and they are emails such as donation tax receipts, registration confirmation emails, shop tax receipts, etc

There are many different automated emails and these can also be overriden at event, page and theme level as well as be completely disabled.

Automated Emails don't require the ability to unsubscribe.

Triggers
These are emails (or SMS) that can be sent to a donor or fundraiser in result of an action such as donating. These are generally used as a reward and often combined with gamification badges.

Fundraiser Emails
These are emails sent by a logged in fundraiser to their own friends or family etc. These are technically sent by the platform however they are sent on behalf of the logged in fundraiser and are labelled as coming FROM the logged in fundraiser, therefore these don't require the ability to unsubscribe.

Adding Automated Emails

On occasion when customising a site there is a need to send out emails other than what is available in the standard automated emails list. For this we have the ability to add in additional emails via the admin but this is currently limited to Funraisin Developers only.

Once added you will be able to access the email via a code using the following method.

$EmailDetails=MySQLArray("SELECT * FROM lk_emails_automated WHERE email_code='CODE'");

Programmatically Sending Emails

Sometimes when adding in custom code there is a need to send out custom emails via Custom PHP code. Below is some example code on how that can be done.

$data["SetupDetails"]=PlatformSetup();

$CI =& get_instance();

$CI->load->library('Mailgun');

$CI->mailgun->clear();

if(isset($data["SetupDetails"]["email_region"]) && $data["SetupDetails"]["email_region"] == 'EU') { $CI->mailgun->region($data["SetupDetails"]["email_region"]); }

$CI->mailgun->from(stripslashes($data["SetupDetails"]["email_from_name"]) .'<'.$data["SetupDetails"]["email_from_email"].'>');

$CI->mailgun->replyto($data["SetupDetails"]["email_replyto_email"]);

$CI->mailgun->to('joe@domain.com');

$CI->mailgun->subject(stripslashes($EmailSubject));

$CI->mailgun->message(stripslashes($EmailBody));

$CI->mailgun->domain($data["SetupDetails"]["email_smtp_user"]);

$CI->mailgun->apikey($data["SetupDetails"]["email_smtp_apikey"]);

$CI->mailgun->send();