What to use in 'SmtpMail.SmtpServer = "???", in Microsoft Exchange Server
I am trying to write code to send a simple mail from asp.net page. Confusion is over what to write under "smtp server", when I want to send mail using Microsoft Outlook 2007.
Two sets of code I'm trying:- 1.)
MailMessage objMail = new MailMessage();
objMail.From = "angenlina.jolie@compnayabc.com";
objMail.To = "brad.pitt@companyabc.com";
objMail.BodyFormat = MailFormat.Text;
objMail.Priority = MailPriori开发者_StackOverflow社区ty.High;
objMail.Subject = "Hi Sweetheart";
string smtpadd = "USA-LA-MAIL1.corp.hollwood.com";
SmtpMail.SmtpServer = "smtpadd";
SmtpMail.Send(objMail);
2.)
SmtpClient smtp = new SmtpClient();
smtp.Port = 25;
smtp.Host = "USA-LA-MAIL1.corp.hollwood.com";
smtp.Credentials = new NetworkCredential("username", "password");
MailMessage email_msg = new MailMessage();
email_msg.To.Add("brad.pitt@companyabc.com");
email_msg.From = new MailAddress("angenlina.jolie@companyabc.com");
email_msg.Subject = "test mail...";
email_msg.Body = "Hi SweetHeart";
email_msg.IsBodyHtml = false;
smtp.Send(email_msg);
Now my problem is what server name should I use for Microsoft outlook 2007(MS exchange server)?
Now my problem is what server name should I use for Micrsoft outlook 2007(MS exchange server)?
Are you sending email via MAPI (using their "Outlook profile") or via SMTP through an Exchange Server? They're not the same.
If you are sending through Exchange then the server will need to be configured to relay mail via SMTP. In which case, put the Exchange server in as the SMTP server.
If you're sending email via MAPI then you'll be using whatever mail server is configured in their "Outlook profile". Which could be SMTP, IMAP, Webmail (with a Hotmail connector or Gmail connector) or Exchange Server.
EDIT:
It sounds like you want to use the Exchange server via MAPI. Here is a good primer to the technologies involved.
Bear in mind that if you're configuring MAPI profiles from within the ASP .NET application you're going to pay attention to the service account the ASP .NET application runs as and that the MAPI is sometimes interactive and not suitable for service based applications.
You may be better off having an administrator configure the Exchange server to route email via SMTP (which is most likely is, unless you have a spam appliance in front of the server which handles SMTP).
try something generic i.e Email Client setup information
IMAP server: imap.smtpserver.in
POP server: pop.smtpserver.in
SMTP server: smtp.smtpserver.in
Webmail To access your email through a web browser visit http://webmail.smtpserver.in smtpserver.in is your smtpserver host address.
精彩评论