title: How to add base64 image data as attachment?
body: <p>I want to create email via EmailMultiAlternatives but I have image data as base64 - from POST data. And I want to send it as attachment via email. </p>
  
  <p>For now I have (view):</p>
  
  <pre><code>    ctx = { 'username': request.user.username, 'img': request.POST['image'] }
  
      subject, from_email, to = 'Hello', 'mailfrom@server', 'mailto@server'
      text_content = 'text only'
      html_content = render_to_string('visemail.html', ctx)
      msg = EmailMultiAlternatives(subject, text_content, from_email, [to])
      msg.attach_alternative(html_content, "text/html")
      msg.send()
  </code></pre>
  
  <p>template:</p>
  
  <pre><code>&lt;img src="{{ img }}" /&gt;
  </code></pre>
  
  <p>But I get email with text:</p>
  
  <pre><code>&lt;img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB....
  </code></pre>
  
  <p>I do not see the picture in content. So I want to send this image as attachment maybe.</p>
  
  <p>How to do this?</p>