5

I want to create one submission form with file/image upload. Image for company logo/picture etc. Normally I know how to attach images, as an attachment in the mail, but I want image attached on mail body as an image tag so when I open my email I can see all filed with image then print it from email.

Example email message below

<table width="500" border="1" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <th scope="row">Your Name</th>
      <td>[your-name]</td>
    </tr>
    <tr>
      <th scope="row">Your Email</th>
      <td>[your-email]</td>
    </tr>
    <tr>
      <th scope="row">Subject</th>
      <td>[your-subject]</td>
    </tr>
    <tr>
      <th scope="row">Your Message</th>
      <td>[your-message]</td>
    </tr>
    <tr>
      <th scope="row">Picture</th>
      <td><img src="[file-305]"></td>
    </tr>
  </tbody>
</table>

Is there any way to send image on image tag in mail body or it can be sent full from as a pdf file ?

if there have any free or paid plugins that also ok.

pagol
  • 507
  • 9
  • 27

4 Answers4

0

I would suggest you modify the email composing routine a bit and include the image as base64 as an inline image.

First conver the image to base64 using How to convert an image to base64 encoding?

$path = 'path/to/uploaded-file/myimage.png';
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);

Then include it in your email using embedding image in html email

<img src="<?= $base64 ?>" />

And most email clients should readily accept it. Otherwise you can always refer to the content id in the email of the attached file

<img src="cid:part1xxxxxxxxxx" alt="">
Tschallacka
  • 27,901
  • 14
  • 88
  • 133
  • thank you so much try. actually i am not much expert for those code. i checked but i don't much understand. can you share with me how i can i do it my theme – pagol Feb 08 '19 at 00:50
0

Yes. You can send an image through user input

I found the following resources Check this out :

  1. enter link description here

  2. Download CF7 – HTML Email Template Extension

  3. this is the format for File Upload [file your-file filetypes:pdf|txt limit:2mb]

File Uploading and Attachment

Monkey D. Luffy
  • 181
  • 1
  • 3
  • 16
  • thanks for your try. actually i mansion i want image as under img tag for mail body. so that when open mail i can see image in body not as attachment. – pagol Feb 08 '19 at 00:48
0

You can try this for printing image in email body:

<img src="[url-file-305]"/>

Use this plugin to send form data with a PDF file: Send PDF for Contact Form 7

Lucas Wieloch
  • 818
  • 7
  • 19
Talib
  • 1
  • 1
0

the best and easiest way to do is just install the plugin " Contact Form Entries". further create a contact form having file upload field and test the same. when you upload an image and send the contact form. the uploaded image will be saved in your wordpress directory.

In my case it was uploaded in the following folder: https://jssngo.org/wp-content/uploads/crm_perks_uploads/62da94f8afa179639552259563503/2022/07/photo.png

now use the following code in your email body:

image Tag src="https://jssngo.org/wp-content/uploads/crm_perks_uploads/62da94f8afa179639552259563503/2022/07/[file-990]"

replace the "src=" with yours and replace the [file-990] tag with yours created in contact form 7.