By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,245 Members | 884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,245 IT Pros & Developers. It's quick & easy.

what is smtp host name for sending mail using yahoomail ID?

P: 47
Hello all
I am using smtp for sending mail.
it ask the smtp host name. that is
Expand|Select|Wrap|Line Numbers
  1.  smtp.Host = "smtp.gmail.com";
  2.  
what is for yahoo/rediff/hotmail

is there any one for globle mail systems.

the other problem is it ask for Credentials
I have to give my gmail user name and password which I donn want to supply.
Expand|Select|Wrap|Line Numbers
  1.  smtp.Credentials = new System.Net.NetworkCredential
  2.              ("yourgmailemailID@gmail.com", "yourGmailPassword");
  3.  
plz help me to come out thi problem.

thank you
Jan 2 '10 #1
Share this Question
Share on Google+
4 Replies


tlhintoq
Expert 2.5K+
P: 3,525
Whether it is outlook, or Microsoft mail, or Thunderbird mail, or the program you make to do mail... you have to tell it what email account to use.

That email account consists of a server, account name and password. That is the nature of email.
Jan 2 '10 #2

P: 47
I am Talking about mail sending in Asp.Net using C#.
I have the following code
Expand|Select|Wrap|Line Numbers
  1. using System.Net.Mail
  2.  
Expand|Select|Wrap|Line Numbers
  1.  MailMessage mail = new MailMessage();
  2.         mail.To.Add("kkapilchoubisa@gmail.com");
  3.         mail.From = new MailAddress("kkapilchoubisa@rediff.com");
  4.         mail.Subject = "hi";
  5.         mail.Body = "Hello dear hw r u";
  6.         SmtpClient smtp = new SmtpClient();
  7.         smtp.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
  8.         try
  9.         {
  10.             smtp.Send(mail);
  11.         }
  12.         catch
  13.         {
  14.         }
  15.  
It generates no exception but kkapilchoubisa@gmail.com can not get any email.

I have another code:

Expand|Select|Wrap|Line Numbers
  1. using System.Net.mail;
  2.  
Expand|Select|Wrap|Line Numbers
  1.  MailMessage mail = new MailMessage();
  2.  
  3.         mail.To.Add("kkapilchoubisa@gmail.com");
  4.  
  5.         mail.From = new MailAddress("kkapilchoubisa@rediff.com");
  6.  
  7.         mail.Subject = "Test Email";
  8.  
  9.         mail.Body = "This is a test mail!!";
  10.  
  11.         string atch = Server.MapPath("problem.docx");
  12.         mail.Attachments.Add(new Attachment(atch));
  13.         SmtpClient smtp = new SmtpClient();
  14.  
  15.         smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address   587
  16.  
  17.         smtp.Credentials = new System.Net.NetworkCredential
  18.            ("yourGmailID@gmail.com", "yourGmailPassword");
  19.         //Or your Smtp Email ID and Password
  20.         smtp.EnableSsl = true;
  21.         smtp.Send(mail);
  22.  
this code runs successfuly. Please tell me what can I do in my first code by which I avoid to pass my EmailId and Password.


These all is in Asp.net using C# code

Thanks
Jan 4 '10 #3

tlhintoq
Expert 2.5K+
P: 3,525
Please tell me what can I do in my first code by which I avoid to pass my EmailId and Password.
You can't. It doesn't matter if you are using ASP or BASIC. Email requires an account. It has to be sent from someone.
Jan 4 '10 #4

Plater
Expert 5K+
P: 7,872
SMTP servers generally will NOT send mail to an email account it does not controll, without first logging in as a valid user.

For example:
If i send mail with smtp.mydomain.com, I can probably send email to JoeUser@mydomain.com without "logging in", but if i wanted to send an email to JoeUser@gmail.com, then I would need to authenticate with smtp.mydomain.com (possibly as say plater@mydomain.com and then a password) in order to send out the email.
Jan 5 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.