Frontdan gelen base64 file contenti mail de attachment kimi gondermek

String cnt = attachmentDto.getContent();

int index = cnt.indexOf(",") + 1;

// cnt = cnt.replaceFirst("^data:image/[^;]*;base64,?", "");

cnt = cnt.substring(index);

byte[] bytes = javax.xml.bind.DatatypeConverter.parseBase64Binary(cnt);

mimeMessageHelper.addAttachment(

   attachmentDto.getName(),

   new ByteArrayResource(bytes)

); 

Comments

Popular posts from this blog

Validation for AZ phone numbers with RegEx in Java

Java necə işləyir, kod nədir ?

@Transactional annotation haqqinda. Cascade istifade olunmasi