Hello Everyone,
I have to send mail from one static id to microsoft office outlook.i will send code of my .please help me
sending id="[email protected]";
to:"[email protected]";
public Outlook.Account GetAccountForEmailAddress(Outlook.Application application, string smtpAddress)
{
// Loop over the Accounts collection of the current Outlook session.
Outlook.Accounts accounts = application.Session.Accounts;
foreach (Outlook.Account account in accounts)
{
// When the e-mail address matches, return the account.
if (account.SmtpAddress == "[email protected]")
{
return account;
}
}
throw new System.Exception(string.Format("No Account with SmtpAddress: {0} exists!", smtpAddress));
}
Outlook.Application oApp = new Outlook.Application();
Outlook._NameSpace oNamespace;
Outlook.MAPIFolder oOutbox;
oNamespace = oApp.GetNamespace("MAPI");
oNamespace.Logon(null, null, true, true);
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.Subject = "Sign In......!";
oMsg.To = "[email protected]";
Outlook.Account account = GetAccountForEmailAddress(oApp,"[email protected]");
oMsg.SendUsingAccount = account
oMsg.Send();
oMsg = null;
oApp = null;
to anyone
i hope you will send me help in code
ChippPosted Sep 24, 2015, 9:48 AM
Manish SolankiPosted Sep 24, 2015, 6:47 AM
Rajeesh MenothPosted Sep 24, 2015, 6:43 AM
Manish SolankiPosted Sep 24, 2015, 6:33 AM
Rajeesh MenothPosted Sep 24, 2015, 6:28 AM
Manish SolankiPosted Sep 24, 2015, 6:14 AM
Rajeesh MenothPosted Sep 24, 2015, 5:37 AM
Manish SolankiPosted Sep 24, 2015, 5:19 AM
Rajeesh MenothPosted Sep 24, 2015, 5:12 AM
Manish SolankiPosted Sep 24, 2015, 4:34 AM
Rajeesh MenothPosted Sep 24, 2015, 3:47 AM
Manish SolankiPosted Sep 24, 2015, 3:45 AM
Rajeesh MenothPosted Sep 24, 2015, 3:34 AM
Manish SolankiPosted Sep 24, 2015, 3:09 AM
Rajeesh MenothPosted Sep 23, 2015, 10:55 PM
ramya bharathPosted Sep 23, 2015, 3:47 PM
Use mailitem.senderemailaddress to fix the address