PHP email template

Post Reply
Paul Barrett
Posts: 82
Joined: Sun Apr 08, 2018 6:52 pm

PHP email template

Post by Paul Barrett »

Hi Steve

This is not a phpbb question but this is the closest category I could find. :)

I am using a GDPR plugin that send emails. Instead of using WordPress templates they have coded the texts into php, and they are sent as plain text.

I have been able to make them look less spammy by editing the text to readable English but, as a minimum I'd like to include a banner image. But I can't find the syntax.

Here's the php

Code: Select all

<?php
echo sprintf(
	/* translators: 1: The request content, 2: confirmation link, 3: reset password link */
	esc_html__(
'From: OurFamilyHistory.club

A request has been made to correct your personal information on our site.
If this request came from you please click the link below to confirm, and we will do our best to fulfil it.

--------------------------------------------------------
Request
--------------------------------------------------------
%1$s




Click here to confirm: %2$s



---------------------------------------------------------------------------------
If the request did not come from you please take immediate action to reset your password: %3$s
', 'gdpr' ),
	esc_html( $args['data'] ),
	esc_url_raw( $args['confirm_url'] ),
	esc_url_raw( $args['forgot_password_url'] )
);
The image file is located in the folder:

Code: Select all

/srv/users/paulbarrett/apps/ourfamilyhistory/public/wp-content/uploads/EmailHeader
(this is on a hosted site, not the NAS.

Any assistance gratefully received. :)
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: PHP email template

Post by steven »

(I misread your post, this does not embed an image in a email)
 
Sorry for the slow reply I was on a business trip.

Use html with embedded php to display a background or a background image and any another image as well. The link below contains an xhtml compliant file you can download and modify. You can use the webkit color for the background or comment it out and display a background image. Change the example image to add your own image and change the text color and font. Replace the example php code with the code you want to use.

I just updated the zip file to center the image toward the top of the page. Since I don't know what you're trying to achieve this is a guess on my part.

html_banner.zip
(1007 Bytes) Downloaded 1378 times
Last edited by steven on Tue Jul 24, 2018 9:11 am, edited 3 times in total.
Paul Barrett
Posts: 82
Joined: Sun Apr 08, 2018 6:52 pm

Re: PHP email template

Post by Paul Barrett »

Excellent. Thanks Steve

BTTW, when you follow a link from a notification email to a topic here, you get caught in a GDPR trap with no escape. You are told you cannot follow any link till you have accepted the GDPR policy but any attempt to get to the policy just displays the same error.

You have to separately login to the site to see the GDPR and Cookie messages.

Just thought you might like to know?
Paul Barrett
Posts: 82
Joined: Sun Apr 08, 2018 6:52 pm

Re: PHP email template

Post by Paul Barrett »

Just to clarify one point.

The file into which I need to insert the code is a php file. I have no way of changing the called file type. So can I just put the html into the php file?
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: PHP email template

Post by steven »

The file download is a php file and contains both html and php. This should work fine provided you don't have any errors in the file. If you look toward the end of the file you can see some php code there. You can renane this file and replace the php code with whatever code you want to use.

Thanks for the heads up on the GDPR notice. The only info stored on my site are emails addresses from registered users which are kept private so for me this GDPR stuff is a bit of a pain.
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

Re: PHP email template

Post by steven »

Not only was I on an extended trip but I must have been tired as well. I completely misread your post. The file I posted adds images to a web page not an email. To embed an image in email check this post.
Paul Barrett
Posts: 82
Joined: Sun Apr 08, 2018 6:52 pm

Re: PHP email template

Post by Paul Barrett »

Thanks Steve.

The plugin's author has since responded that they are going to allow the email templates to be edited using the Visual Editor. I think I'll wait for that. :)
Post Reply