Home » Sharepoint

Send a email from abc@yahoo.com to xyz@gmail.com

     i have used system.net.mailmessage to do this.

But i dont get this working.I now that i need to change some data in web.config file.Can some one help me out with this ??

This is my code :

 MailMessage mm=new MailMessage("srp_oucse@yahoo.com","pauljason89442@gmail.com","Hello This is your password",pass);
        SmtpClient cl = new SmtpClient();
        cl.Host = ConfigurationManager.AppSettings["SMTP"];

This is what i have changed in web.config file

    <add key="SMTP" value="mail.site.com"/>

mail.site.com is my local smtp server to which i tried to  ping and it is working too.


3 Answers Found


Answer 1

First thing I would check is the SMTP mail  server log or BadMail folder. The SMTP server  log should show if the mail is actually arriving at the server and then the reason why it was rejected or failed.

Answer 2

First thing I would check is the SMTP mail  server log or BadMail folder. The SMTP server  log should show if the mail is actually arriving at the mpg server and then the reason why it was rejected or failed.
Internet Alarm Monitoring web  sites developed in ASP.Net

Maybe it is because the transport protocols they used are not the same. Suggest you to check if what yahoo used is SMTP?

Answer 3

i am som sirdharth roy.male 25.from kolkata.languages known bengali,hindi,english nationality.indian like to makes friends to roam one place toanother . email  id roy.som2007@gmail.com somsidharthroy@gmail.com persuing bba first year


I want my ASP.Net onbuttonclick to send simple email from my Yahoo/Gmail account.

Any document pointing to how to set this up on settings etc ?




I cannot seem to send an email via my gmail account using "C#" why not?




		<smtp deliveryMethod="Network" from="ian.coetzer@gmail.com">
			<network host="smtp.gmail.com" port="587" enableSsl ="true" defaultCredentials ="false" password ="xxxxxx" userName ="ian.coetzer@gmail.com"></network>
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();

  message.Subject = "";
  message.Body = GetEmailBody(userName, password, url);


  return true;
catch(Exception ex)
  throw new ApplicationException("Could not send notification.", ex);


I.W Coetzer


Has anyone, within the past two or three days, successfully sent an email through SMTP.GMAIL.COM using Net.Mail.SmtpClient?

I have several programs that tested OK and now I get error messages ending in "has failed to respond" (or :587).

Has Gmail "pulled the plug"?

Alternately, if someone provides a different SMTP (and I can sign up for an email account and use it successfully), that will be considered an answer to the question (plus you will have my full gratitude).



Hi everybody,

how are?

Can you tell me, what is the difference between the URL www.abc.com and abc.com


Sadequzzaman Monoj



Hi all,

       i am using forms authentication for my website www.abc.com, i wanna use the same website authcookie for aaa.abc.com.

What steps i need to follow


Hi All,

I am trying to implement WCF Method where client has to pass like "abc\xyz" as a string i have to capture it and pass to my method. I am not able to do it. In our application we can split the string  and we can do what ever we can do . but string comes from client site so who do i capture into my method. I am very much new in WCF.

Could u please help me.




I've got a SQL 2008 database server, and a VS 2010 project.

Each of the databases is getting the above errors for SQL logins only.

The VS project has a database project for each database, plus a server project which is referenced in each of the database projects.

I have schema-compared the server project to the server's master db, and there are no discrepancies with the logins.

What do I need to do to get past this error?



I have a strange question. We have few users in our SharePoint sites, whose SPUser.Name is being displayed as "AD\abc.xyz" as opposed to "abc xyz". Can someone tell me why are they being displayed in that manner? "AD" is our group domain. At the same time, majority of users are being displayed properly.

We do not have user profile synchromization running but why do majority of users get displayed fine?

Any pointers?



I have setup a subscription to a report that sends an email in MHTML format.  I send the email to my exchange/outlook address and it looks fine.  I send the same e-mail to a test GMAIL account, and it seems to strip out all the formatting I setup in the report?

Anyone else seen this, or have a workaround?



I use the below code to send emails. It works fine if I use gmail (Server: smtp.gmail.com and Port: 587) but when I try to send from a hotmail and another yahoo address with these settings it doesn´t work.

So I wonder why I cant send From Yahoo and Hotmail with those settings:

Hotmail settings does not work:

        String From = "oneMail@hotmail.com";
        String Password = "passWord";

        String EmailServer = "smtp.live.com";
        int Port = 25;

Yahoo settings does not work:

        String From = "oneMail@yahoo.com";
        String Password = "passWord";

        String EmailServer = "smtp.mail.yahoo.com";
        int Port = 25;


Code below:

        //String From = "oneMail@hotmail.com";
        //String Password = "passWord";

        //String EmailServer = "smtp.live.com";
        //int Port = 25;

        String From = "oneMail@yahoo.com";
        String Password = "passWord";

        String EmailServer = "smtp.mail.yahoo.com";
        int Port = 25;

            MailMessage mm = new MailMessage(From, "To@hotmail.com");

            mm.Subject = "Test1";
            mm.Body = "Test2";

            SmtpClient smtp = new SmtpClient(EmailServer, Port);

            mm.IsBodyHtml = false;
            smtp.EnableSsl = true;
            smtp.UseDefaultCredentials = true;

            NetworkCredential NetworkCred = new NetworkCredential(); //Your UserName And password
            NetworkCred.UserName = From;
            NetworkCred.Password = Password;
            smtp.Credentials = NetworkCred;

            mm = null;
            smtp = null;
            ClientScript.RegisterStartupScript(Page.GetType(), "TestAlert", "alert('" + "Email Sent!" + "');", true);



i tried many thing but not able to send d mail from my application.

Kindly guide me for d same....

          System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
         msg.Subject = "Something";
msg.Body = " mail test" + DateTime.Today.ToString();
          msg.IsBodyHtml = false;

SmtpClient SMPclint = new SmtpClient();
          SMPclint.Host = "smtp.gmail.com";

          SMPclint.EnableSsl = true;

           NetworkCredential NetCry = new NetworkCredential();
          NetCry.UserName = "myID@gmail.com";
          NetCry.Password = "myPasswd";
          SMPclint.UseDefaultCredentials = true;
          SMPclint.Credentials = NetCry;

          SMPclint.Port = 587;

but d code is giving error as well as i m not abe to send the mail by using the same.


how to send email using yahoo or hotmail live id i not say for google mail service GMS

because Google solve my problem that how to send email using gmail

i want to import contacts from gmail, yahoo etc when you give the username and password like in sites like hi5 and myspace. how do i do this?? i use visual studio 2003.


hi i have try many code for sending email from msdn and many sites.but still i could do so.

some code are here...

  SmtpClient smtpClient = new SmtpClient();

        MailMessage message = new MailMessage();




            MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);


            // You can specify the host name or ipaddress of your server

            // Default in IIS will be localhost 

            smtpClient.Host = "localhost";


            //Default port will be 25

            smtpClient.Port = 25;


            //From address will be given as a MailAddress Object

            message.From = fromAddress;


            // To address collection of MailAddress


            message.Subject = "Feedback";


            // CC and BCC optional

            // MailAddressCollection class is used to send the email to various users

            // You can specify Address as new MailAddress("admin1@yoursite.com")




            // You can specify Address directly as string

            message.Bcc.Add(new MailAddress("admin3@yoursite.com"));

            message.Bcc.Add(new MailAddress("admin4@yoursite.com"));


            //Body can be Html or text format

            //Specify true if it  is html message

            message.IsBodyHtml = false;


            // Message body content

            message.Body = txtMessage.Text;


            // Send SMTP mail



            lblStatus.Text = "Email successfully sent.";


        catch (Exception ex)


            lblStatus.Text = "Send Email Failed.<br>" + ex.Message;


but it is not working.wat should i do. wat this line do .i want a proper copy paste which wll run .and i wll b able to send mail to any

destination .plz help 



   i am creaing a address book and i want to imports the contacts from the website like yahoo, gmail, hotmail, & so



Im sending email through gmail smtp server :

For the NetworkCredential  i used :
user name : u1
password : p1
That have from email : u1@gmail.com

When i sending the message i set from email : newU@gmail.com,
Despite of i did do this when the email sent the u1@gmail.com displayed at the from email,
How can i cause it to display newU@gmail.com at the from email ?




I have installed the email-router for crm 4.0. The emails for internal users that are using the exchange will be delivered. If I enter the primary email address for user@google.com the email cannot be delivered.

Should I set Relay on the Exchange? or sendconnector? I have done it, but it does not working!

Any idea?

Thanks in advance



I am trying to send email from my asp .net code ,it is sending email to email ids except gmail.com.

all mails with gmail.com is going into my Badmail folder in inet pub folder in my local system.

Code i am using is-

SmtpClient client = new SmtpClient();
        client.Host = "mail.abc.com";        
        client.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
        client.Credentials = new System.Net.NetworkCredential("ab", "rr");  
        client.Port = 25;
        string to = "arvind.abes@gmail.com";
        string from = "rvsales@westrvwholesaler.com";

        MailMessage mail = new MailMessage(from, to);
        mail.Subject = "hello......?";
        mail.IsBodyHtml = true;
        mail.Body = "hi, how are you?may be this will work";
        mail.Priority = MailPriority.High;
        //client.EnableSsl = true;        

        catch (Exception ex)
            Exception ex2 = ex;
            string errorMessage = string.Empty;
            while (ex2 != null)
                errorMessage += ex2.ToString();
                ex2 = ex2.InnerException;

What could be the issue? plz help me.


Arvind Pathak


I had been using SP2010 Beta for 7 months or so, and had the task lists set up such that when a task was assigned to someone, an email was sent to that person. I moved over to RTM, and am having trouble getting this to work. An email will be sent to the person assigned to the task when something in the task changes, but not when it is first created/assigned. Can someone help shed some light to this? I have smtp configured correctly, and the task list's advanced settings are set so that Email Notification is sent when ownership is assigned or when an item changes.

Please Advise.


I have SMTP configured corrently and can send emails with no problem. There is one place in my workflow that sends a reminder email if a task is not complete (after a Delay activity). When the reminder email is sent, I get the following error in the History Log: The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly. -- The weird thing is that the email still sends, and the workflow continues to run. I am using the SendMail activity rather than the SPUtility at this point (and the sendmail code used to put the email together is the same as a previous sendmail activity which works fine). Additionally, the error only happens on the first reminder, but all subsequent email reminders do not show the error and send just fine. I am also not able to catch the issue through the debugger. Any ideas?

<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure