2016-09-19 85 views
-1
mail.Body = "your appointment has been scheduled on :" + txtappointment.Text + " " + txtmessage.Text; 
+0

你想換行(
)還是換一個新行? –

+0

換行兄弟 – babi

回答

0

試試這個

mail.Body ="your appointment has been scheduled on :"+ <br> + txtappointment.Text +" "+ txtmessage.Text; 
+0

我想在「txtmessage.text」之前添加break標籤; – babi

+0

iam期待輸出是::您的約會已安排在29-9-2016下一行早上10:00上午 – babi

0

你可以試試這個+Environment.NewLine+

mail.Body ="your appointment has been scheduled on :"+ <br> + txtappointment.Text +System.Environment.NewLine+ txtmessage.Text; 
0

這是實例用解決你的問題,嘗試了一次,你的答案評論在我的片段。

//mail.Body ="your appointment has been scheduled on :"+ txtappointment.Text +"\n"+ txtmessage.Text; 
 
var Fname = "samudrala"; 
 
var Lname = "Raamu"; 
 
alert(Fname+"\n"+Lname);

+0

正確的代碼是:: mail.Body =「您的約會已計劃在:」+ txtappointment.Text +「\ n「+ txtmessage.Text; – babi

+0

雅正確的代碼 –

+0

發送你的郵件兄弟...任何疑問我要求你 – babi

0

根據你的意見,你需要這樣的事情(和你應該使用string.Format方法,便於串管理:

mail.Body = string.format("your appointment has been scheduled on: {0}<br/>{1}", txtappointment.Text, txtmessage.Text); 

你可以看到你的文本編輯器的文本佔位符,第一個是預約,第二個是預約,對於html的工作,你必須設置IsBodyHtml這個標誌:

mail.IsBodyHtml = true; 

如果您的電子郵件客戶端不支持HTML或你不希望它是HTML中,使用Environment.NewLine不變,爲@AsifuzzamanRedoy建議,像這樣:

mail.Body = string.format("your appointment has been scheduled on: {0}{2}{1}", txtappointment.Text, txtmessage.Text, Environment.NewLine); 
相關問題