Attachments are a historical enemy of email marketing for, among others, the following reasons:
The files may contain viruses or other security threats.
Attachments are embedded in the email making it take up much more space.
The campaigns become slower.
Mail providers are forced to scan files for viruses and need to consume more transfers and bandwidth to manage them.
That is why email marketing tools do not usually support or strongly discourage the use of attachments.
Link instead of attach
The recommendation for cases in which you need to send a file by email is to link said file instead of attaching it, this offers a series of improvements:
The files are not embedded in the email, so it is lighter.
By using links it is possible to track their opening
The file can be altered once the campaign has been sent.
Sending attachments
Despite being discouraged, teenvio allows the sending of attached files for some of its plans. For this, the following parameters can be used in the sending requests:
attachmen_base64raw: String with the content of the file in base64
There is the possibility to include an attached image and have it used in the HTML instead of using an external resource in your href. This functionality corresponds to the _rfc2392 standar. Thanks to this it is possible to view an image without the manager asking if we want to show external resources.
To use this functionality, you must add an attached file with a PNG or JPG image whose combo matches the name of the piece or template. The file name in the template must not contain paths and must be just the file name.
To consider
If our creative only has one image and we use this method to embed it, we can have collateral damage: The recipients may not authorize the display of external resources (since the main image is already displayed) and thus prevent the platform from knowing the openings actual shipment.
importrequeststoken='Your token'url_base='https://app.teenvio.com/v4/public/api/rest/v3'my_headers={'Accept':'application/json','X-Token':token,'Content-Type':'application/json'}post_request={"rid":1,"name":"transactional image test from api","subject":"subject transactional image email","recipients":["contact1@domain.com","contact2@domain.com"],"vars":{"descuento":20,"caducidad":"noviembre"},"html_body":"<html><img src=\"header.png\"><p>Hola mundo con imagen incrustada</p> <p>Por cierto, tu descuento del [[[descuento]]]% caduca en [[[caducidad]]]</p></body>","attachmen_base64raw":"iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAHElEQVQ4y2M0+M9ANmBiYBjVPKp5VPOo5oHUDAAGPAFXwSLvZAAAAABJRU5ErkJggg==","attachmen_filename":"header.png"}response=requests.post(url_base+"/bulkcampaign/",json=post_request,headers=my_headers)print(response.json())
constaxios=require('axios');consttoken='Your token';consturl_base='https://app.teenvio.com/v4/public/api/rest/v3';constmy_headers={'Accept':'application/json','X-Token':token};constpost_request={"rid":1,"name":"transactional image test from api","subject":"subject transactional image email","recipients":["contact1@domain.com","contact2@domain.com"],"vars":{"descuento":20,"caducidad":"noviembre"},"html_body":"<html><img src=\"header.png\"><p>Hola mundo con imagen incrustada</p> <p>Por cierto, tu descuento del [[[descuento]]]% caduca en [[[caducidad]]]</p></body>","attachmen_base64raw":"iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAHElEQVQ4y2M0+M9ANmBiYBjVPKp5VPOo5oHUDAAGPAFXwSLvZAAAAABJRU5ErkJggg==","attachmen_filename":"header.png"}axios.post(url_base+'/bulkcampaign/',post_request,{headers:my_headers}).then(resp=>{console.log(resp.data);});