when i am trying to send email it comes in the source address(bob_babab2005@yahoo.com).i am trying to send mail to others using my yahoo account.
i want to send email to others like abc@gmail.com
how to do this.....
code given bellow----
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
//using System.Web.Mail;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SmtpClient client = new SmtpClient("smtp.mail.yahoo.com", 587);
MailMessage mail_msg = new MailMessage();
MailAddress fromAdd = new MailAddress(txtFrom.Text.Trim(), txtName.Text.Trim());
mail_msg.From = fromAdd;
mail_msg.To.Add("bob_babab2005@yahoo.com");
mail_msg.Subject = "Contact Me";
mail_msg.IsBodyHtml = true;
mail_msg.Body = "Message From: " + txtFrom.Text.Trim() + "Subject:" + txtCc.Text.Trim()+ "Email: " + txtTo.Text.Trim() + "Comment: " + txtComments.Text.Trim();
System.Net.NetworkCredential basicCredential = new System.Net.NetworkCredential("bob_babab2005@yahoo.com", "*********");
//client.EnableSsl = true;
client.UseDefaultCredentials = true;
client.Credentials = basicCredential;
client.Send(mail_msg);
}
}
sourabh