URGENT: Need to set / override Return-Path

Hello,

Thanks for the reply.

I have got your idea. It looks some miscommunication here. We will provide such feature shortly.

Best regards,

You can use MailMessage.Sender to do the same work as the ReturnPath in EasyMail. If Sender is not null, we will use it in Mail Form command during the smtp sending. Otherwise, we will use MailMessage.From.

The QuikSoft.EasyMail defines the ReturnPath as following:

The value specified by this property is optional and only used with the SMTP "MAIL FROM" command during the SMTP conversation. This command indicates to the SMTP host, the e-mail address of the message sender and will receive any returned failure message. If this value is not set then the From address is used.

This is good to know, but could you extend the MailMessage object to include a property for Return-Path, in addition to, Sender? I tested your suggestion by setting the Sender property. The email was sent, but when Outlook renders the email message it displays the Sender information in the From line.

In Outlook, the From line is shown as:

From: <> on behalf of <>

Example:

From: bounce [“bounce” <bounce@<>>]; on behalf of; [senderemail@sendingcompany.com]

Here’s the message body that generates the above:

Microsoft Mail Internet Headers Version 2.0
Received: from <> ([0.0.0.0]) by <> with Microsoft SMTPSVC(6.0.3790.3959);
Tue, 15 Apr 2008 09:44:42 -0400
Received: from <> (<> [0.0.0.0])
by <> (Mail Daemon) with ESMTP id D7AC14C5A07;
Tue, 15 Apr 2008 09:41:26 -0400 (EDT)
Message-ID: <6E38C5EA35804B47848B794F861CF0E5@<>>
Date: Tue, 15 Apr 2008 09:44:01 -0400
From: "[senderemail@sendingcompany.com](mailto:senderemail@sendingcompany.com)" <[senderemail@sendingcompany.com](mailto:senderemail@sendingcompany.com)>
Reply-To: “” <[senderemail@sendingcompany.com](mailto:senderemail@sendingcompany.com)>
Subject: Test Email Test 2
Sender: “bounce” <bounce@<>>
To: <[validuser@someserver.com](mailto:validuser@someserver.com)>
Content-Type: multipart/alternative;
boundary="------_=_NextPart_001_C5D643CC.D77D8F45"
MIME-Version: 1.0
Return-Path: bounce@<>
X-OriginalArrivalTime: 15 Apr 2008 13:44:42.0203 (UTC) FILETIME=[DB877AB0:01C89EFE]

--------_=_NextPart_001_C5D643CC.D77D8F45
Content-Type: text/plain;
charset=us-ascii

--------_=_NextPart_001_C5D643CC.D77D8F45
Content-Type: text/html;
charset=utf-8
Content-Transfer-Encoding: quoted-printable

--------_=_NextPart_001_C5D643CC.D77D8F45–


By setting only the Return-Path directly and not via the Sender property, Outlook Should render it properly.

Also, I have not received any “bounce” messages back from the receiving MTA server by setting the Sender property. So, for now, this is not working. (On a side note, the QuikSoft component, when setting the Return-Path and sending a “bad” email message to a MTA, the MTA sends a bounce message back relatively quickly). This is why I’m saying that the Aspose Return-Path/Sender may not be working as this is my basis of comparison.

If you’d like to work through this problem directly, I can send you my IM information via private email.

Thanks for your help and quick attention.

Cheers.

Hello,

Could you add my MSN for the discussion? Moreover, could you please provide me the mail message (eml file) that you sent with Quiksoft? It looks like something different on the mail message file. Because from their feature description, we did the same.

My MSN is guangzhou$$aspose.com, (replace the $$ with @)

Best regards,

Hello,

Please check the attached dll.

MailMessage template = new MailMessage();

//add template field to subject
template.Subject = "Hello, #FirstName#";
template.From = new MailAddress("dgertz@mycompay.com", "dgertz@mycompay.com");
template.Headers["return-path"] = new MimeHeader("return-path", "#ReturnPath#");
//add template field to receipt
template.To.Add(new MailAddress("#Receipt#", true));

//add template field to html body
//use GetSignment as the template routine, which will provide the same signment.
template.HtmlBody = "Dear #FirstName# #LastName#";

//create a new TemplateEngine with the template message.
TemplateEngine engine = new TemplateEngine(template);

//fill a DataTable as data source
DataTable dt = new DataTable();
dt.Columns.Add("Receipt", typeof(string));
dt.Columns.Add("FirstName", typeof(string));
dt.Columns.Add("LastName", typeof(string));
dt.Columns.Add("ReturnPath", typeof(string));
DataRow dr;
dr = dt.NewRow();
dr["Receipt"] = "kylehuangyu2@gmail.com";
dr["FirstName"] = "Nancy";
dr["LastName"] = "Davolio";
dr["ReturnPath"] = "dgertz@mycompay.com";

dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Receipt"] = "kylehuangyu3@gmail.com";
dr["FirstName"] = "Andrew";
dr["LastName"] = "Fuller";
dr["ReturnPath"] = "dgertz@mycompay.com";

dt.Rows.Add(dr);
dr = dt.NewRow();
dr["Receipt"] = "kylehuangyu4@gmail.com";
dr["FirstName"] = "Janet";
dr["LastName"] = "Leverling";
dr["ReturnPath"] = "dgertz@mycompay.com";
dt.Rows.Add(dr);

MailMessageCollection messages;
try
{
//create the messages from the template and datasource.
messages = engine.Instantiate(dt);

Aspose.Network.Mail.SmtpClient client = new SmtpClient("smtp.gmail.com");

client.EnableSsl = true;

for (int i = 0; i < messages.Count; i++)
{
client.Send(messages[i]);
}
}
catch (MailException ex)
{
System.Diagnostics.Debug.Write(ex.ToString());
}

Hi,

I've downloaded and tested the HotFix (Aspose.Network.dll ver: 3.8.1.7) and it is still not working as expected. Bounce messages are still not routing properly. Due to the project's delivery timeline, I have had to, unfortunately, abandon the Aspose.Network component.

I wish to thank you for your time, attention and quick feedback to my request/need. I would encourage Aspose to continue development of this feature.

Cheers.

Hi Jeroen,

I did some tests with the latest release and still found some issues. I have logged this as bug in our issue tracking system (ID: 15562). We will look into it and notify you when it is fixed. Sorry for the inconvenience.

Hi,

When you set return path using the following statement:
MailMessage.Headers[“return-path”] = "mail@domain.com";

It adds the return-path in the header when you send the email. You can also check it by saving the message as eml (MailMessage.Save method) and viewing the eml file in notepad. The header is there. But, when the message is sent, it may pass through a chain of servers and each server may override the return path.