Embed signatures as inline image into HTML email
-
First of all thanks for your work to create this plugin. We tried all major form plugins for our customers, and always return to CF7 because of its simplicity and flexibility.
Also your signature plugin allows us to create forms for registrations and many other use cases where a signature is needed.
While working with it we wanted to have the signatures as embedded images in the email messages, which also makes them basically unnecessary to save on the webserver.
As your signature field already returns the image Base64 encoded we modified your plugin this way:
function wpcf7_manage_signature ($posted_data) { foreach ($posted_data as $key => $data) { if (is_string($data) && strrpos($data, "data:image/png;base64", -strlen($data)) !== FALSE){ $data_pieces = explode(",", $data); $encoded_image = $data_pieces[1]; // Make the signature available as Base64 encoded image for inline use in HTML Email $posted_data[$key.'-inline'] = $data; $decoded_image = base64_decode($encoded_image); $filename = sanitize_file_name(wpcf7_canonicalize($key."-".time().".png"));
Now we simply add a tag with suffix “-inline” to the form post data, containing the Base64 encoded image.
In the Email Template we use:
<img src="[signature-inline"] />
and the signature is being included on the HTML Email as embedded image without URL reference back to the server.
Maybe you can include this in your upcoming updates, so we can keep this. Also this may be helpful to other users. By having the signature embedded into the email we do not need to create a PDF or such, we simply print the email and have the right documentation with the signature on.
- The topic ‘Embed signatures as inline image into HTML email’ is closed to new replies.