Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Email not sending in live environment with Email_Template class


Go to End


1912 Views

Avatar
Wows

Community Member, 4 Posts

26 April 2008 at 6:29pm

Hi,

The contact form I've setup works fine in my local environment, but once I've deployed it to live, it doesn't send an email - there are no errors it displays and everything appears to work, but no email is sent.

Immediately I thought it was the SMTP configuration, and after checking that and testing sending emails another way, I'm really puzzled.

If I send an email using the standard email class like this:
$e = new Email('blah@blah.com', 'blah@blah.com', 'subject', 'message');
$e->send();

It works ok, but when I used the Email_Template class to send an email with a template file and data values - nothing happens:
$email = new Email_Template();
$email->ss_template = 'ContactUsEmail';
$email->populateTemplate($fields);
$email->subject = 'Subject';
$email->from = 'blah@blah.com';
$email->to = 'blah@blah.com';
$email->send();

Now this all works fine in my local environment. Both local and live have PHP v 5.1.4 installed. Any ideas what the problem could be????