for send mail in asp.net query.
I don`t want to show email id given in credentials as from id when it comes to inbox, for eg. if [email protected] is used in credentials and in from there is [email protected] i want to show [email protected] as sender when mail comes in inbox
Testdemo ForemailPosted Feb 6, 2015, 3:04 AM
Testdemo ForemailPosted Feb 6, 2015, 2:38 AM
string from = "[email protected]";//Set Here dt.rows[0][0] with your fild from Database
NetworkCredential NetworkCred = new NetworkCredential(Id,Pass);
when open the inbox and display a mail id at that time display from maiil for inbox mail
Saber ShaikhPosted Feb 6, 2015, 2:07 AM
Testdemo ForemailPosted Feb 6, 2015, 1:57 AM
Testdemo ForemailPosted Feb 6, 2015, 1:56 AM
NetworkCredential logininfo = new NetworkCredential("[email protected]", "12345679");
SmtpClient msmtpclient = new SmtpClient();
MailMessage msg = new MailMessage();
msg.From = new MailAddress("[email protected]", "jagdishparmar");
msg.To.Add(new MailAddress("[email protected]"));
msg.Subject = "Hello";
msg.Body = "To stop receiving these emails please click here to unsubscribe.";
msg.IsBodyHtml = true;
msmtpclient.Host = "smtp.gmail.com";
msmtpclient.Port = 587;
msmtpclient.EnableSsl = true;
msmtpclient.UseDefaultCredentials = true;
msmtpclient.Credentials = logininfo;
msmtpclient.Send(msg)
Saber ShaikhPosted Feb 6, 2015, 1:46 AM
(A) is Login --- And Send To Mail (B)
Or
(A)is Login -- And Send Mail By (B)
How Can That Posible witch is your Requerment 1 or 2
Testdemo ForemailPosted Feb 6, 2015, 1:39 AM
I don`t want to show email id given in credentials as from id when it comes to inbox,
for eg. if [email protected] is used in credentials and in from there is [email protected] (this come for database dynamic)
i want to show [email protected] as sender when mail comes in inbox
Saber ShaikhPosted Feb 6, 2015, 1:11 AM
http://aspnettutorialscode.blogspot.in/2013/11/aspnet-send-email-using-gmail-or-gmail.html
Suraj SahooPosted Feb 5, 2015, 8:23 AM
Configuration c = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)c.GetSectionGroup("system.net/mailSettings");
you can use this two lines instead of identity
Please try this
Suraj SahooPosted Feb 5, 2015, 7:13 AM
You can use one thing make the from part in the web config dynamic by the below peice of code:
public void saveIdentity(string frommailID)
{
Configuration objConfig = WebConfigurationManager.OpenWebConfiguration("~"); IdentitySection identitySection = (IdentitySection)objConfig.GetSection("system.net/mailSettings/smtp");
if (identitySection != null)
{
identitySection.from= frommailID;
}
objConfig.Save();
}
Please try this. I hope this will work
Thanks
Testdemo ForemailPosted Feb 5, 2015, 6:37 AM
i have Gmail id and pass....k
i can send mail this id and pass
but when receiver receive mail at time time what we write from email id just display in inbox
this from email id.not credential email id display.
credential is common but from email id is changable...
plz help me..
Suraj SahooPosted Feb 5, 2015, 5:50 AM
Suraj SahooPosted Feb 5, 2015, 4:29 AM
then the web config change mentioned will do the same thing
Suraj SahooPosted Feb 5, 2015, 3:21 AM
You can set the default from address in the webconfig.
somewhat like below: