When I write more than one paragraph in the mail body, it is going only as a single paragraph. There is no space between paragraph. For example in the mail paragraph the body is like that :
I am coming tomorrow. I will call you when I landed. fdfdfffdfdfdffd
fddffdfff.
See you soon.
Fatih
the result like that:
I am coming tomorrow. I will call you when I landed. fdfdfffdfdfdffd
fddffdfff. See you soon. Fatih
How can we solve this problem?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
using System.Net.Mail;
using System.Net;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["nick"] == null)
Response.Redirect("giris.aspx");
else
Response.Write(""); ;
}
protected void Button1_Click(object sender, EventArgs e)
{
string isim = string.Empty;
string soyisim = string.Empty;
string email = string.Empty;
string body = string.Empty;
OleDbConnection cnn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Server.MapPath(@"..\datam_benim2541\uyelerim_benim2541.mdb"));
OleDbCommand bulten = new OleDbCommand("SELECT isim, soyisim, email FROM uyeler", cnn);
if (cnn.State == ConnectionState.Closed)
{
cnn.Open();
}
OleDbDataAdapter bdr = new OleDbDataAdapter(bulten);
DataTable dt = new DataTable();
bdr.Fill(dt);
cnn.Close();
foreach (DataRow row in dt.Rows)
{
isim = row["isim"].ToString();
soyisim = row["soyisim"].ToString();
email = row["email"].ToString();
body = string.Format("Sayın; {0} {1},<br/><br/>{2}<br/><br/>", isim, soyisim, txtmesaj.Text, "\r\n");
SendEmail(email, txtkonu.Text, body);
}
lblmesaj.ForeColor = System.Drawing.Color.Green;
lblmesaj.Text = "E-Postalar Başarıyla Gönderildi";
txtkonu.Text = "";
txtmesaj.Text = "";
}
private bool SendEmail(string recipient, string subject, string body)
{
MailMessage mm = new MailMessage("xxxx@xxxx.com.tr", recipient);
mm.Subject = subject;
mm.Body = body;
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.xxxx.com.tr";
smtp.EnableSsl = false;
NetworkCredential NetworkCred = new NetworkCredential();
NetworkCred.UserName = "xxxx@xxxx.com.tr";
NetworkCred.Password = "xxxxx";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
return true;
}
protected void LinkButton1_Click1(object sender, EventArgs e)
{
Session.Abandon();
Response.Redirect("giris.aspx");
}
}