R K Sharma
R K Sharma

Reputation: 855

how to change return path in smtp mail settings in asp.net?

Can any one guide me on how i can send emails with a return path in ASP.net 3.5 / C# 3.5. I know this was possible few years back but now due to spoofing issues this is not possible. I have been looking on internet but no use. I want the emails if bounced, should reach my bounce mail box, which could be like [email protected].

I am using simple smtp.

when i try to do like this:

mailMessage.ReturnPath = "[email protected]"

it gives me compile time error

returnpath is not a member of system.net.mail.mailmessage?

Upvotes: 0

Views: 1125

Answers (2)

Naveen
Naveen

Reputation: 1461

Indirecly From and sender address will your returnpath and directly you can use this syntax:

MailMessage message = new MailMessage();
message.Headers.Add("Return-Path", "[email protected]");

Upvotes: 1

D3vy
D3vy

Reputation: 986

mailMessage.From

mailMessage.Sender

Not the same thing, one of them will do what you are looking for, from memory, I cant remember which one, but Im pretty sure its the sender.

Upvotes: 2

Related Questions