Jump to content

Recommended Posts

Posted (edited)

I have a page which sends out an email based on queries in the url

<?php

	// event ID
	$eventID = $input->get('eventID','int');
	$event = $pages->get($eventID);

	// config
	$adminEmail = "events@test.com";
	$fromEmail = "noreply@test.com";
	$fromName = "test";
	$emailSubject = "Test Email";

	// HTML BODY
	$emailBody = ""; // HOW TO ??? …

	// send mail
	$m = new WireMail();
	$m->to($adminEmail);
	$m->from($fromEmail, $fromName);
	$m->subject($emailSubject);
	$m->bodyHTML($emailBody);
	$m->send();
?>

The email body is a bit complex: standard html/css tables and some php (pw variables).
I put my emailbody (html) in a seperate file emailbody.inc but don't know how to include it?
 

Edited by ngrmm
solved
Posted

You could use PHP output buffering to read your file into a variable. Something like:

ob_start();

include('./emailbody.inc');

$emailBody = ob_get_clean();

 

  • Like 2

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...