Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I send MIME data with an email using c# aspx
    primarykey
    data
    text
    <p>I want to send a password email to a user, however the customer wants an image embedded (inline) in the email.</p> <p>I created an email, saved the data to a txt file, during my code I read in the template but when I send it the line endings are broken and therefore the MIME data is broken. I just get =3D</p> <p>What am I doing wrong?</p> <pre><code> string FILENAME = Server.MapPath("~/GuestUserTemplate.txt"); StreamReader objStreamReader = File.OpenText(FILENAME); string sEmailTemplate = ""; string input = null; while ((input = objStreamReader.ReadLine()) != null) { sEmailTemplate = sEmailTemplate + input; } objStreamReader.Close(); /* send an email */ MailMessage msg = new MailMessage(); msg.IsBodyHtml = true; msg.To.Add(new MailAddress(sToEmail)); msg.From = new MailAddress(sFromEmail); msg.Subject = sEmailSubject; msg.Body = sEmailTemplate; //try { client.Send(msg); } //catch (Exception excm) { } </code></pre> <p>Just done a bit more detective work. The email I am sending out has this in the header:</p> <pre><code>MIME-Version: 1.0 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable </code></pre> <p>Where as an email which has inline images has:</p> <pre><code>Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/related; boundary="----_=_NextPart_001_01C9C98D.6552117E"; type="multipart/alternative" </code></pre> <p>It seems that I need to set the Content type to multipart but I am not sure how...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload