我如何通过电子邮件正文传递列表?这就是我所拥有的,它返回vehicleNames
和Count
。我需要能够遍历Count
并从列表中获取每个Name
才能附加到电子邮件正文。我尝试将foreach
添加到电子邮件的Body
中,但是每次都会收到一个智能提示错误,因此,如果有可能,我做的不正确。感谢您的帮助。
adminEmail.Body = "<div style='font-family: Arial, sans-serif default; font-size: 11pt;'><h2>Hello " + approverName + ",</h2>" +
"<p>A new key request has been received. Please log in to manage your request(s).</p></div>" +
"<div><hr align=\"left\" width=\"75%\"><br /><h3>Reservation Details</h3>" +
"<ul><li>Driver: " + employee.FirstName + " " + employee.LastName + "</li>" +
"<li>Driver Email: " + employee.HawkeyeEmail + "</li>" +
"<li>Destination: " + reservation.Destination + "</li>" +
"<li>Purpose of Trip: " + reservation.PurposeOfTrip + "</li>" +
"<li>Transporting Students: " + reservation.TransportStudentsFG.ToString() + "</li>" +
help please! --> "<li>Vehicle(s): " + vehicleNames.ToString() + "</li></ul>" + <-- help!
"<p><a href='" + reservationDetailsLink + "'>Click here to view and approve the request.</a></p><br /></div>";
答案 0 :(得分:1)
您可以从此处使用String.Join(..,..)
像这样:
string.Join(“,”,车辆名称)