Попытка запустить код C #, чтобы сделать stmpt и отправить emal пользователям - PullRequest
0 голосов
/ 30 июня 2019

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 Активно

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...