I don't know if this is the right place to send a patch, but here goes. To make inline images work in yahoo mail the images need to be attached with disposition-type "inline" (see rfc 1806). Below is a patch to make this possible:
/// <summary>Adds an included image to the MailMessage using a file path</summary>
/// <param name="filepath">File path to the file you want to attach to the MailMessage</param>
+ /// <returns>The attached image as an Attachment object</returns>
/// <example>
/// <code>
/// MailMessage msg = new MailMessage("support@OpenSmtp.com", "recipient@OpenSmtp.com");
- /// msg.AddImage(@"C:\file.jpg");
+ /// Attachment image = msg.AddImage(@"C:\file.jpg");
+ /// image.DispositionType = "inline";
/// </code>
/// </example>
// start added/modified by mb
- public void AddImage(string filepath)
+ public Attachment AddImage(string filepath)
{
- AddImage(filepath, NewCid());
+ return AddImage(filepath, NewCid());
}
I don't know if this is the right place to send a patch, but here goes. To make inline images work in yahoo mail the images need to be attached with disposition-type "inline" (see rfc 1806). Below is a patch to make this possible:
Index: OpenSMTP/Version.01.11.0/src/MailMessage.cs
--- OpenSMTP/Version.01.11.0/src/MailMessage.cs (revision 751)
+++ OpenSMTP/Version.01.11.0/src/MailMessage.cs (revision 752)
@@ -297,25 +297,32 @@
/// <summary>Adds an included image to the MailMessage using a file path</summary>
/// <param name="filepath">File path to the file you want to attach to the MailMessage</param>
+ /// <returns>The attached image as an Attachment object</returns>
/// <example>
/// <code>
/// MailMessage msg = new MailMessage("support@OpenSmtp.com", "recipient@OpenSmtp.com");
- /// msg.AddImage(@"C:\file.jpg");
+ /// Attachment image = msg.AddImage(@"C:\file.jpg");
+ /// image.DispositionType = "inline";
/// </code>
/// </example>
// start added/modified by mb
- public void AddImage(string filepath)
+ public Attachment AddImage(string filepath)
{
- AddImage(filepath, NewCid());
+ return AddImage(filepath, NewCid());
}
- public void AddImage(string filepath, string cid)
+ public Attachment AddImage(string filepath, string cid)
{
if (filepath != null)
{
Attachment image = new Attachment(filepath);
image.contentid=cid;
images.Add(image);
+ return image;
+ }
+ else
+ {
+ return null;
}
}
Index: OpenSMTP/Version.01.11.0/src/Attachment.cs
===================================================================
--- OpenSMTP/Version.01.11.0/src/Attachment.cs (revision 751)
+++ OpenSMTP/Version.01.11.0/src/Attachment.cs (revision 752)
@@ -46,6 +46,7 @@
// start added by mb
internal string contentid=null;
// end added by mb
+ internal string dispositionType = "attachment";
/// <summary>Constructor using a file path</summary>
/// <example>
@@ -129,6 +130,12 @@
set { this.contentid = value; }
}
+ /// <value> Stores the MIME disposition-type of the attachment (RFC 1806)</value>
+ public string DispositionType
+ {
+ get { return(this.dispositionType); }
+ set { this.dispositionType = value; }
+ }
/// <value> Stores the MIME content-type of the attachment</value>
public string MimeType
@@ -212,7 +219,7 @@
sb.Append("Content-Type: " + mimeType + ";\r\n");
sb.Append(" name=\"" + MailEncoder.ConvertToQP(name,null) + "\"\r\n");
sb.Append("Content-Transfer-Encoding: " + encoding + "\r\n");
- sb.Append("Content-Disposition: attachment;\r\n");
+ sb.Append("Content-Disposition: " + DispositionType + ";\r\n");
sb.Append(" filename=\"" + MailEncoder.ConvertToQP(name,null) + "\"\r\n\r\n");
FileStream fin = new FileStream(encodedFilePath, FileMode.Open, FileAccess.Read);
Arrrggg... SourceForge kille my patch!
Grab it at http://www.twops.dk/Files/OpenSMTP.patch in stead.