Smtp вещи из базы данных попадают и отправляются на электронную почту, если это необходимо в конце процесса
public class sendemail
{
public static void Send(string to, string subject,
string body, string from,
string cc,
IEnumerable<string> filesToAttach,
bool isBodyHtml,
IEnumerable<string> additionalHeaders,
string bcc, string contentEncoding, c.html
<h2>sendemail</h2>
@{
ViewBag.Title = "sendemail";
Layout = "~/_SiteLayout.cshtml";
var customerName = Request["customerName"];
var customerEmail = Request["customerEmail"];
var customerRequest = Request["customerRequest"];
var subjectLine = Request["subjectLine"];
var message = Request["message"];
var fileAttachment = Request["fileAttachment"];
var with = "with";
var errorMessage = "";
// use a try catch block and send the email
try {
// Initialize WebMail helper
WebMail.SmtpServer = "your-smtp-server";
WebMail.SmtpPort = 25;
WebMail.UserName = "your-username";
WebMail.Password = "password";
WebMail.From = "your-email-address";
WebMail.EnableSsl = true;
// Create array containing file name
var filesList = new string [] { fileAttachment };
// Attach file and send email
// if there is no link to file then send email
// without any attachment
if(fileAttachment == null || fileAttachment.IsEmpty()) {
WebMail.Send(to: customerEmail,
Ошибка:
Код серьезности Описание Подавление строки файла проектаОшибка состояния CS0501 'sendemail.Send (строка, строка, строка, строка, строка, IEnumerable, bool, IEnumerable, строка, строка, строка, строка, строка)' должна объявлять тело, поскольку оно не помечено как абстрактное, внешнее или частичноеBharat547 C: \ Users \ bharatsharma \ source \ repos \ Bharat547 \ Bharat547 \ Models \ sendemail.cs 11 Активно