# Email with Image 

**URL:** <https://forum.wixstudio.com/t/email-with-image/7120>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [October 5, 2021, 2:02am UTC](https://forum.wixstudio.com/t/email-with-image/7120 "2021-10-05T02:02:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahaliarun32](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/mahaliarun32/32/10434_2.png) [@mahaliarun32](https://forum.wixstudio.com/u/mahaliarun32)\
**Post date:** [October 5, 2021, 2:02am UTC](https://forum.wixstudio.com/t/email-with-image/7120/1 "2021-10-05T02:02:30Z")

</div>

Hi Good day,  
Looks like the Website has been modified, as this function to send email with the image was working couple of weeks ago.  
Was any change implemented lately?  
Below is the code snippet

* * *

import wixData from ‘wix-data’ ;  
import { sendEmail , sendEmailWithRecipient } from ‘backend/email’ ;

function sendFormData () {  
const convertRegex = **new** RegExp ( /wix:document://v1/([^/]+)/(.\*)$/ );  
const item = $w ( “#dataset1” ). getCurrentItem ();  
let Document01 = “” ;  
if ( item . document01 === **undefined** ) {  
Document01 = “” ; }  
**else** {  
const Doc01 = item . document01 . match ( convertRegex );  
Document01 = `docs.wixstatic.com/ugd/ ${ Doc01 [1]} ?dn= ${ Doc01 [2]}`;  
}  
let wiximageurl = “[https://static.wixstatic.com/media/](https://static.wixstatic.com/media/)” ;  
let image1local = “” ;  
if ( item . image01 === **undefined** ) {  
const image1Url = “h” ;}  
**else** {  
image1local = item . image01 . replace ( ‘image://v1/’ , ‘’ );  
image1local = wiximageurl + image1local . substr ( image1local . lastIndexOf ( ‘/’ ) + 1 );  
}  
const image1Url = image1local ;  
const subject = `Commercial Lease Application ` ;  
const body = `Document 01: ${( Document01 )} and Image 01: ${ image1Url }`;  
const recipient = “[mahaliarun32@gmail.com](mailto:mahaliarun32@gmail.com)” ;  
sendEmail ( subject , body )  
. then ( response =\> console . log ( response ));  
sendEmailWithRecipient ( subject , body , recipient )  
. then ( response =\> console . log ( response ));  
}
