Hi,
i am bumping this old thread because it seems that this feature was never implemented and i am urgently in need of this functionality.
To recap: Even if i set the “Return-Path” header to some email address as suggested in this thread, this header is ignored by the SmtpClient class, instead when sending the envelope information to the SMTP server, the SmtpClient uses either Sender or From properties of the MailMessage class to get the value for the “MAIL FROM” envelope attribute.
I am not quite sure that using the “Return-Path” header is the best way to provide this information for the SmtpClient. Maybe you could provide a new property in the MailMessage class (name for example EnvelopeSender) or a property and/or method parameter in the SmtpClient class…
Please let me know what you thing and possibly an ETA for this feature.
Thank you
Regards
Robert
Hi Robert,
Hello Babar,
thank you for your reply, i will try to explain our situation and what we want to achieve.
We are using Aspose components to create and send emails from support agents to customers.
We want the the mails to go out with the agent’s email address as the sender (“From” header in the mail message).
In case these mails bounce we want those bounces go to the a predetermined bounce mailbox and not to the agent’s mailbox.
We are using the “Errors-To” mail header to try to steer the bounces to the bounce mailbox but the Errors-To is Non-Standard so this works only rarely.
After researching the possible solutions i concluded that the only way to control where the bounces would be sent is to control the envelope information that the SmtpClient class sends to the SMTP Server as the value in the “MAIL FROM” command.
Please be aware that this is not the same as the From header - the from header is part of the message itself, on the other hand the MAIL FROM envelope information is part of the SMTP protocol communication and is send at the beginning of the session before the actual email data is transmitted.
Please see also this article: Bounce address - Wikipedia
The problem is that in the current implementation of the SmtpClient class, the client uses the value from the Sender or the From property of the MailMessage class in the MAIL FROM command .
What i need is a way to supply a different email address for the MAIL FROM command.
Now that could be done in several ways… preferably a new dedicated property of the MailMessage class (named for example EnvelopeFrom) or alternatively a property on the SmtpClient class and/or a method parameter in the Send method.
I mentioned the Return-Path header only because it was part of the discussion in the previous thread and could be an alternative way of providing the information to the SmtpClient.
As you can see, in my previous message i wrote that i am not sure that that would be the best way to do it anyway.
I would actually prefer the dedicated property of the MailMessage class.
I did not provided any code example because there is nothing to show in code.
We also do not use the TemplateEngine but i can imagine that templating could be also useful for this new property.
I also confirmed that the behavior of the SmtpClient class in the latest Aspose.Email version is as described.
I hope my explanation helped to understand my feature request and i am looking forward to your response.
With regards
Robert
Hi Robert,
Hello,
any news regarding our request? We need this feature quite badly.
Thank you
With regards
Robert
Hi Robert,
Hello,
do you have any updates on the progress?
Thanks.
Robert
Hi Robert
Hi Robert,
Hi Babar,
could you please provide details about this feature? How was the functionality implemented? Can you please provide a source code example?
We want to use this functionality with our internal SMTP server.
Thank you.
Robert
Hi Robert,
MailMessage mailMessage = new MailMessage("from@domain.com", "to@domain.com");
mailMessage.Subject = “test”;
mailMessage.Body = “test”;
mailMessage.BodyEncoding = Encoding.UTF8;
mailMessage.Priority = MailPriority.High;
using (SmtpClient client = new SmtpClient(“host address”, 25, “username”, “password”))
{
client.SecurityMode = SmtpSslSecurityMode.Implicit;
client.EnableSsl = true;
client.Send(mailMessage);
}
- Server may be configured to use FROM-field which is transmitted from client to server.
- Server may be configured to use data from the user account which is used to login to Smtp server.
Hello Babar,
i am afraid what you described is not the functionality that we requested. Please look at my explanation in the third post of this thread.
We need to define the value that the SmtpClient sends as part of the MAIL command, this is not the same as the From-Header of the mail message nor is it the same as the user name or email address associated with the user account that was used to authenticate the SMTP connection (it is also possible that the connection is made without authentication).
Please see [RFC 5321 Section 3.3](http://tools.ietf.org/html/rfc5321#section-3.3)
for the detail about the MAIL command. Here is a citation from :
The first step in the procedure is the MAIL command.
MAIL FROM:<reverse-path> [SP <mail-parameters> ] <CRLF>
This command tells the SMTP-receiver that a new mail transaction is
starting and to reset all its state tables and buffers, including any
recipients or mail data. The portion of the first or
only argument contains the source mailbox (between “<” and “>”
brackets), which can be used to report errors (see [Section 4.2](http://tools.ietf.org/html/rfc5321#section-4.2)
for a
discussion of error reporting).
With regards
Robert
Hi Robert,
Hi Again,
public virtual MailAddress ReversePath
The issues you have found earlier (filed as NETWORKNET-33228) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.