O
okardak onur
Guest
below code fails to send mail
email = tbFROM.Text;
passw = tbPASSWORD.Text;
string smtpAddress = "smtp.gmail.com";
int portNumber = 587;
bool enableSSL = true;
string emailFromAddress = email; //Sender Email Address
string password = passw; //Sender Password
string emailToAddress = email; //Receiver Email Address
string subject = "Hello";
string body = "Hello, This is Email sending test using gmail.";
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFromAddress);
mail.To.Add(emailToAddress);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
//mail.Attachments.Add(new Attachment("D:\\TestFile.txt"));//--Uncomment this to send any attachment
using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
{
smtp.Credentials = new NetworkCredential(emailFromAddress, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);
}
}
one below also fails to send email
email = tbFROM.Text;
passw = tbPASSWORD.Text;
//MailMessage mail = new MailMessage(tbFROM.Text,tbTO.Text,tbSUBJECT.Text,rtbBODY.Text);
MailMessage mail = new MailMessage(email,email,email,email);
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com");
smtpClient.Port = 587;
//smtpClient.Credentials = new NetworkCredential(tbUSERNAME.Text,tbPASSWORD.Text);
smtpClient.Credentials = new NetworkCredential(email,passw);
smtpClient.EnableSsl = true;
smtpClient.Send(mail);
google fails to respond...how to SEND EMAIL??
Continue reading...
email = tbFROM.Text;
passw = tbPASSWORD.Text;
string smtpAddress = "smtp.gmail.com";
int portNumber = 587;
bool enableSSL = true;
string emailFromAddress = email; //Sender Email Address
string password = passw; //Sender Password
string emailToAddress = email; //Receiver Email Address
string subject = "Hello";
string body = "Hello, This is Email sending test using gmail.";
using (MailMessage mail = new MailMessage())
{
mail.From = new MailAddress(emailFromAddress);
mail.To.Add(emailToAddress);
mail.Subject = subject;
mail.Body = body;
mail.IsBodyHtml = true;
//mail.Attachments.Add(new Attachment("D:\\TestFile.txt"));//--Uncomment this to send any attachment
using (SmtpClient smtp = new SmtpClient(smtpAddress, portNumber))
{
smtp.Credentials = new NetworkCredential(emailFromAddress, password);
smtp.EnableSsl = enableSSL;
smtp.Send(mail);
}
}
one below also fails to send email
email = tbFROM.Text;
passw = tbPASSWORD.Text;
//MailMessage mail = new MailMessage(tbFROM.Text,tbTO.Text,tbSUBJECT.Text,rtbBODY.Text);
MailMessage mail = new MailMessage(email,email,email,email);
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com");
smtpClient.Port = 587;
//smtpClient.Credentials = new NetworkCredential(tbUSERNAME.Text,tbPASSWORD.Text);
smtpClient.Credentials = new NetworkCredential(email,passw);
smtpClient.EnableSsl = true;
smtpClient.Send(mail);
google fails to respond...how to SEND EMAIL??
Continue reading...