如何使用c#创建recap电子邮件模板?

时间:2017-06-13 06:05:43

标签: c# html

大家好我需要使用c#创建recap电子邮件模板。我正在为此创建一个小型演示,但这不是一个支持o / p。能帮到我任何一个我想要的人吗?

这是我的c#代码:

 string MailBody1 = @"<div style='padding:10px;width: 100%;background-color:#f0f0f0;'>
                                                <div style='padding:25px;font-size: 20px;background-color:#403b3b;hight:20px;'></div>
                                                                                     <div style='text-align:left;'>Hey," + User.NAME + "</div>";
                        MailBody1 += @"This is for you.";

                        if (result.ListUsers[i].ListFeed != null)
                        {
                            var re1 = result.ListUsers[i].ListFeed.Distinct().ToList();
                            var Data1 = re1.GroupBy(t => t.FeedId).Select(g => g.First()).Take(5).ToList();
                            for (int j = 0; j < Data1.Count(); j++)
                            {
                                if (j % 2 == 0)
                                    MailBody1 += @"<div style='width:60%;'>";
                                else
                                    MailBody1 += @"<div style='width:40%;'>";

                                    MailBody1 += @"<img src='" + FeedMediaPath + Data1[j].Url.ToString();
                                    MailBody1 += @"' width='50%' hight='50%'>";

                                MailBody1 += @"<div style='width:50%;'><h5 style='text-align: justify;'>" + Data1[j].Description.ToString().Trim().TrimEnd('\r', '\n');
                                MailBody1 += @"</h5></div>";
                                MailBody1 += @"</div>";
                            }
                            MailBody1 += @"</div>";                                
                        }

&#13;
&#13;
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
			<title>Excel To HTML using codebeautify.org</title>
		</head>
		<body>
			<div style='padding:10px;width: 100%;background-color:#f0f0f0;'>
				<div style='padding:25px;font-size: 20px;background-color:#403b3b;hight:20px;'></div>
				<div style='text-align:left;'>Hey,abc </div>this is for you
				<div style='width:60%;'>
					<img src='https://ci6.googleusercontent.com/proxy/QD8LXpFzcveyvSTClPgwt80WjuckwBOYZmN_0n9wuQ7fwbrsDolOLqKw6d-TrKlo4p8roqJRFBiiIv9aGEuMSQYDEpX3-bI0obhTxugtIfumw14XN_HnphepXiEwwOB6nSDZRu9IJF-QJaiwhHWk_ZEs-trMewpxoLiIC1Mv7B3bN3IE7FuJzYQ=s0-d-e1-ft#http://i.ytimg.com/vi/e2644ylntQQ/sddefault.jpg?w=640&h=360&feature=em-subs_digest&sigh=2OtiYi0Z-QhxEWZ6gj_6TWFOhoM' width='50%' hight='50%'>
						<div style='width:50%;'>
							<h5 style='text-align: justify;'>Test 1</h5>
						</div>
					</div>
					<div style='width:40%;'>
						<img src='https://ci5.googleusercontent.com/proxy/zaInbZ-UzqcTg5xtEn4_VxF3i9ncj8Tgp8rQsvo1GD7B59RMd5Rw2h3mD3osIDlhquxkbc7qhRDZrLIZAUgZdCHt9EguFsaeuaISqevRTHIWizJ9aPWWowAVC_l_9308OLChiiYJBlmPX-zZSef3D2Q5H22ajotF32ErbxfApKN2TLUYAE27a0g=s0-d-e1-ft#http://i.ytimg.com/vi/KiP9CYOL1QI/sddefault.jpg?w=640&h=360&feature=em-subs_digest&sigh=r5zSMmQQToPZF2zB-qD2Kr8BcIM' width='50%' hight='50%'>
							<div style='width:50%;'>
								<h5 style='text-align: justify;'>test 2</h5>
							</div>
						</div>
						<div style='width:60%;'>
							<img src='https://ci6.googleusercontent.com/proxy/avWBvpWny4vCI2Adub9AP6CTqjIc34m4KYbJr-KW-4HRkJ2-jiNPkkr2bkUtVC24tBVd5DJH2DdYtXRDI7kCFp26_ezvxvEwEw_LQWusri2vuaIv-x4s1NeflxkhfIakDPaS2D_vKtk-ACnW2m6DzD8BEgAQP1gepMtiZrf76ETIhgSlzEG4ChU=s0-d-e1-ft#http://i.ytimg.com/vi/Pz1KgzAoffc/sddefault.jpg?w=640&h=360&feature=em-subs_digest&sigh=nExBtDtnuvUc6I8_jxJn_31EIXQ' width='50%' hight='50%'>
								<div style='width:50%;'>
									<h5 style='text-align: justify;'>test 3.</h5>
								</div>
							</div>
							<div style='width:40%;'>
								<img src='https://ci4.googleusercontent.com/proxy/OUT6-vQzv1BCNkA5bKwhXOiGigztDtiwZZw0CFruqFZ7hXe0gNsNtZHBsb5h0iclReZ4qM-noAYN19U165hbPQKUSVVNms1aStJu-tTojniOwrCyvIPwqMCZOmCanzbLEMJE2Xf3y3aX8DynnPhmbxMviJuoMEGm23BANMiFBB4Rulx6vk0JXZA=s0-d-e1-ft#http://i.ytimg.com/vi/TeOecMBTnCI/sddefault.jpg?w=640&h=360&feature=em-subs_digest&sigh=5YLQxtwEYy697iqOBjTtn4BeQ0k' width='50%' hight='50%'>
									<div style='width:50%;'>
										<h5 style='text-align: justify;'>test 4</h5>
									</div>
								</div>
								<div style='width:60%;'>
									<img src='https://ci4.googleusercontent.com/proxy/-ev7NjEIxdkhOvzNISGpVkw149EuFOo9_PJx7hTAydN7I72BL5_D5bStTMzTNeypy7tlQ2LfVwIVa44RFZE-hPdHwCLix6y1I8ouC7W82Urqd3X9ZUnfXlpJ5J-J-IFu2cp43usB4dID5t4dlhkBCrpNJk4pRLnRisRCTfzyMrywn_K1ZKF9E2Y=s0-d-e1-ft#http://i.ytimg.com/vi/G1SdCNdPDL8/sddefault.jpg?w=640&h=360&feature=em-subs_digest&sigh=dNpeGzez7Ibl6LBrX9payANBkkE' width='50%' hight='50%'>
										<div style='width:50%;'>
											<h5 style='text-align: justify;'>test 5</h5>
										</div>
									</div>
								</div>
							</body>
						</html>
&#13;
&#13;
&#13;

这是我的预期o / p =&gt; enter image description here

我想在广场上喜欢这张图片但是现在我的图像是一行的,所以我不想这样做。任何人怎么办呢,请告诉我。

0 个答案:

没有答案