Jump to content

PHP code not working in email template


Recommended Posts

Hello! I hope this should be an easy one. I'm trying to add a simple greeting to my email templates for "Good morning", etc., but no email is sent after adding the PHP code. I wasn't able to locate any errors. My template is as follows:


$now = getdate();
$hrs = $now['hours'];
$greeting = "";

if ($hrs >= 17) {
$greeting = "Good evening";
else if ($hrs >= 12) {
$greeting = "Good afternoon";
else {
$greeting = "Good morning";

echo $greeting;

Message here.

Thank you,


Also, WHMCS does not appear to be referencing the from "name" I've defined for this email template. That is, the first field after "From:", but before where the email address is specified. Can anyone tell me what might be causing this?

Link to comment
Share on other sites

Update: It does appear that this field is being ignored. A change of the department name revealed that the new ticket email template is using the syntax <companyName> <departmentName>. How can I force WHMCS to use the "from" name that I have specified in the email template?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated