Здравствуйте, я пытаюсь отправить и отправить электронное письмо с html документом
проблема в том, что когда я создаю файл html перед отправкой почты, не было проблем с html документом
но когда я открываю этот отправляющий html документ, он отличается
, вот мой html документ перед отправкой;
<html lang="tr">
<head>
<meta charset="utf-8">
<title>A5 landscape</title>
<!-- Normalize or reset CSS with your favorite library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<!-- Load paper.css for happy printing -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.4.1/paper.css">
<link href="https://fonts.googleapis.com/css?family=Libre+Barcode+128&display=swap" rel="stylesheet">
<style>
barkod {
font-family: 'Libre Barcode 128', cursive;;font-size: 50px;
}
</style>
<!-- Set page size here: A5, A4 or A3 -->
<!-- Set also "landscape" if you need -->
<style>@page { size: A5 portrail }</style>
<style>
#myDiv {
border: medium solid black;
}
#myhr {
border: thin solid black;
}
</style>
</head>
<!-- Set "A5", "A4" or "A3" for class name -->
<!-- Set also "landscape" if you need -->
<body class="A5 landscape">
<!-- Each sheet element should have the class "sheet" -->
<!-- "padding-**mm" is optional: you can set 10, 15, 17% or 25 -->
<section class="sheet padding-10mm">
<!-- Write HTML just like a web page -->
<article>
<tr>
<td width="100%" align="center" ><img src height="35px" width="15%" /></td>
</tr>
<div cellspacing="0" cellpadding="0" width="100%" height="100%" id="myDiv" >
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="17%" valign="top"><p><strong>Gönderici Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"><p align="right" name="date">13.03.2020</p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="senderCustomerName">Şirket İsmi :</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="senderPhone">Şirket Tel :</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="100%" colspan="3" valign="top"></td>
</tr>
<td colspan="4"><hr id="myhr"></td>
<tr>
<td width="17%" valign="top"><p><strong>Alıcı Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerName">Ad/Soyad :</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerAddress">Adres :</p></td>
<td width="83%" colspan="2" rowspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerDistrict">Semt :</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerCity">Şehir :</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerPostCode">Posta Kodu :</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerPhone">Ev/Cep Telefonu :</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Ödeme Tipi :</p></td>
<td width="83%" colspan="2" valign="top"><p><strong name="paymentType">N11 Öder (Alıcı tarafından platform üzerinden ödendi)</strong></p></td>
</tr>
<td colspan="4"><hr id="myhr"></td>
<tr>
<td width="17%" valign="top"><p><strong>Sipariş Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Sipariş Numarası :</p></td>
<td width="83%" colspan="2" valign="top" name="sipno">205534347395</td>
</tr>
<tr>
<td width="17%" valign="top"><p>Kargo Firması :</p></td>
<td width="83%" colspan="2" valign="top"><p>Yurtiçi</p></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Ödeme Tipi :</p></td>
<td width="83%" colspan="2" valign="top"><p><strong name="paymentType">N11 Öder (Alıcı tarafından platform üzerinden ödendi)</strong></p></td>
</tr>
<td colspan="4"><hr id="myhr"></td>
<tr>
<td width="20%" valign="top" align="right"><p>Kampanya Kodu :</p></td>
<td width="20%" valign="top">833009532488669</td>
<td width="35%" rowspan="2" valign="top" align="left" ><p><strong>Kampanya kodunun hata vermesi durumunda çıkış yapmayınız, gönderici firma ile irtibata geçiniz</strong></p></td>
</tr>
<tr>
<td width="40%" colspan="2" valign="top" align="center"><barkod> 833009532488669 </barkod></td>
</tr>
</table>
</div>
</article>
</section>
</body>
</html>
, и этот html документ загружается с почты вложения
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">.backpack.dropzone {
font-family: 'SF UI Display', 'Segoe UI';
font-size: 15px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 250px;
height: 150px;
font-weight: lighter;
color: white;
will-change: right;
z-index: 2147483647;
bottom: 20%;
background: #333;
position: fixed;
user-select: none;
transition: left .5s, right .5s;
right: 0px; }
.backpack.dropzone .animation {
height: 80px;
width: 250px;
background: url("chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/assets/backpack/dropzone/hoverstate.png") left center; }
.backpack.dropzone .title::before {
content: 'Save to'; }
.backpack.dropzone.closed {
right: -250px; }
.backpack.dropzone.hover .animation {
animation: sxt-play-anim-hover 0.91s steps(21);
animation-fill-mode: forwards;
background: url("chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/assets/backpack/dropzone/hoverstate.png") left center; }
@keyframes sxt-play-anim-hover {
from {
background-position: 0px; }
to {
background-position: -5250px; } }
.backpack.dropzone.saving .title::before {
content: 'Saving to'; }
.backpack.dropzone.saving .animation {
background: url("chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/assets/backpack/dropzone/saving_loop.png") left center;
animation: sxt-play-anim-saving steps(59) 2.46s infinite; }
@keyframes sxt-play-anim-saving {
100% {
background-position: -14750px; } }
.backpack.dropzone.saved .title::before {
content: 'Saved to'; }
.backpack.dropzone.saved .animation {
background: url("chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/assets/backpack/dropzone/saved.png") left center;
animation: sxt-play-anim-saved steps(20) 0.83s forwards; }
@keyframes sxt-play-anim-saved {
100% {
background-position: -5000px; } }
</style></head><body>
<div>
<table><tbody><tr>
<td width="100%" align="center"><img height="35px" width="15%"></td>
</tr>
<tr><td><div cellspacing="0" cellpadding="0" width="100%" height="100%">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody><tr>
<td width="17%" valign="top"><p><strong>Gönderici Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"><p align="right" name="date">06.04.2020</p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="senderCustomerName">Şirket İsmi : ALKINd ÇAKIRALAR</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="senderPhone">Şirket Tel : 5357394980</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="100%" colspan="3" valign="top"></td>
</tr>
<tr><td colspan="4"><hr></td>
</tr><tr>
<td width="17%" valign="top"><p><strong>Alıcı Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerName">Ad/Soyad : EndeksB2B</p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerAddress">Adres : fikirtepe mahallesi, hızırbey caddesi 1071 kadiköy sitesi c blok d:206</p></td>
<td width="83%" colspan="2" rowspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerDistrict">Semt : Kadiköy</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerCity">Şehir : İzmir</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerPostCode">Posta Kodu : 34859</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p name="customerPhone">Ev/Cep Telefonu : 5357394980 5357394980</p></td>
<td width="83%" colspan="2" valign="top"><p> </p></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Ödeme Tipi :</p></td>
<td width="83%" colspan="2" valign="top"><p><strong name="paymentType">N11 Öder (Alıcı tarafından platform üzerinden ödendi</strong></p></td>
</tr>
<tr><td colspan="4"><hr></td>
</tr><tr>
<td width="17%" valign="top"><p><strong>Sipariş Bilgileri</strong></p></td>
<td width="83%" colspan="2" valign="top"></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Sipariş Numarası :</p></td>
<td width="83%" colspan="2" valign="top" name="sipno">internet-134</td>
</tr>
<tr>
<td width="17%" valign="top"><p>Kargo Firması :</p></td>
<td width="83%" colspan="2" valign="top"><p>Yurtiçi</p></td>
</tr>
<tr>
<td width="17%" valign="top"><p>Ödeme Tipi :</p></td>
<td width="83%" colspan="2" valign="top"><p><strong name="paymentType">N11 Öder (Alıcı tarafından platform üzerinden ödendi</strong></p></td>
</tr>
<tr><td colspan="4"><hr></td>
</tr><tr>
<td width="20%" valign="top" align="right"><p>Kampanya Kodu :</p></td>
<td width="20%" valign="top">833009532488669</td>
<td width="35%" rowspan="2" valign="top" align="left"><p><strong>Kampanya kodunun hata vermesi durumunda çıkış yapmayınız, gönderici firma ile irtibata geçiniz</strong></p></td>
</tr>
<tr>
<td width="40%" colspan="2" valign="top" align="center"> 833009532488669 </td>
</tr>
</tbody></table>
</div>
</td></tr></tbody></table></div>
</body></html>
и мой код c#
using (FileStream fs = new FileStream(@"C:\etiket.html", FileMode.Create))
{
using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
{
await w.WriteAsync(htmlDocument);
}
}
var t = new ContentType("text/html");
ContentType ct = new ContentType(MediaTypeNames.Text.Html);
var att = new Attachment(@"C:\Etiket.html", ct);
message.Attachments.Add(att);
message.Body = "Etiket Çıktısı Ektedir";
await client.SendMailAsync(message);
client.Dispose();
att.Dispose();
после строки файлового потока я открыл "C: \ Etiket. html", это не проблема с документом, но Когда я отправляю тело письма и css строки изменились, как я могу решить эту проблему?