I am making an online system where I have multiple clients and my clients have multiple contacts. Now I want my client to be able to send emails to his contacts, so when his contact gets an email they see his company name and his email address in the field From:abc@abc.com & ABC company.
I am using MVCMailer to send emails it works perfect but when I receive test email, then instead of my clients email address in (TO and NAME) it shows me the email I configured in web.config file. How can I change From address so that my client's contacts can see his email address not mine ?
==========================
<system.net>
<mailSettings>
<!-- Method#1: Configure smtp server credentials -->
<smtp from="xyz@xyz.com">
<network enableSsl="true" host="smtp.xyz.com" port="587" userName="xyz@xyz.com" password="ABC" />
</smtp>
<!-- Method#2: Dump emails to a local directory -->
<!--
<smtp from="some-email@gmail.com" deliveryMethod="SpecifiedPickupDirectory">
<network host="localhost" />
<specifiedPickupDirectory pickupDirectoryLocation="c:\temp\"/>
</smtp>
-->
</mailSettings>
=======================================
This is the code I am using in C# class
var mailMessage = new MailMessage { Subject = eSubject };
mailMessage.To.Add(Email);
mailMessage.Bcc.Add("xyz@xyz.com");
mailMessage.ReplyToList.Add( new MailAddress(From, ContactPerson));
mailMessage.Sender = new MailAddress("xyz@xyz.com", ContactPerson);
//mailMessage.To.Add("some-email@example.com");
//ViewBag.Data = someObject;
ViewData = new ViewDataDictionary(obj);
SmtpClient smtp = new SmtpClient("192.168.1.2",25);
smtp.Credentials = new NetworkCredential("xyz@xyz.com", "test");
smtp.Send("xyz@xyz.com","xyz@xyz.com","test","test");
PopulateBody(mailMessage, viewName, null);
SmtpClient smtp = new SmtpClient("192.168.1.2",25);
smtp.Credentials = new NetworkCredential("xyz@xyz.com", "test");
//smtp.Send("xyz@xyz.com","xyz@xyz.com","test","test");
PopulateBody(mailMessage, viewName, null);
return mailMessage;
========================
Please tell me how can I fix this problem or even is it possible or not with mvc c#?
Riyasat