Quantcast
Channel: Zammad - Community - Latest posts
Viewing all articles
Browse latest Browse all 6728

Unable to Embed Image in Email Body

$
0
0

Here some quick hack, hope it helps :wink:

cache = UploadCache.new(SecureRandom.uuid)
cache.add(
  filename: 'logo.png',
  data: Base64.decode64('iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII'),
  preferences: {
    "Content-Type"=>"image/png", 
    "Mime-Type"=>"image/png", 
    "Content-ID"=>"205.8b56823d-6a49-4665-b9ac-872a3e636e5b@xxx.zammad.com", 
    "Content-Disposition"=>"inline",
  },
  created_by_id: 1,
)

NotificationFactory::Mailer.deliver(
  recipient: User.find_by(email: 'xxx@xxx.com'),
  subject: 'image test',
  body: "hello <img alt='Product Logo' src='cid:205.8b56823d-6a49-4665-b9ac-872a3e636e5b@xxx.zammad.com' />",
  content_type: 'text/html',
  attachments: cache.attachments
)

Viewing all articles
Browse latest Browse all 6728

Trending Articles