using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net; using System.Net.Mail; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); openFileDialog1.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*"; } private void Start_Click(object sender, EventArgs e) { string logi = Textis_Text.Text; MailAddress from = new MailAddress("somemail@gmail.com", Ot_Text.Text); MailAddress to = new MailAddress(Base_Mail_Text.Text); MailMessage m = new MailMessage(from, to); m.Subject = Ot_Text.Text; m.Body = "<h2>" + logi + "</h2>"; m.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.Credentials = new NetworkCredential(Email_Text.Text, Pass_Text.Text); smtp.EnableSsl = true; smtp.Send(m); } private void Upload_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.Cancel) return; // получаем выбранный файл string filename = openFileDialog1.FileName; // читаем файл в строку string fileText = System.IO.File.ReadAllText(filename); Base_Mail_Text.Text = fileText; MessageBox.Show("Файл открыт"); } private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { } } } Код using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net; using System.Net.Mail; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); openFileDialog1.Filter = "Text files(*.txt)|*.txt|All files(*.*)|*.*"; } private void Start_Click(object sender, EventArgs e) { string logi = Textis_Text.Text; MailAddress from = new MailAddress("somemail@gmail.com", Ot_Text.Text); MailAddress to = new MailAddress(Base_Mail_Text.Text); MailMessage m = new MailMessage(from, to); m.Subject = Ot_Text.Text; m.Body = "<h2>" + logi + "</h2>"; m.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); smtp.Credentials = new NetworkCredential(Email_Text.Text, Pass_Text.Text); smtp.EnableSsl = true; smtp.Send(m); } private void Upload_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.Cancel) return; // получаем выбранный файл string filename = openFileDialog1.FileName; // читаем файл в строку string fileText = System.IO.File.ReadAllText(filename); Base_Mail_Text.Text = fileText; MessageBox.Show("Файл открыт"); } private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { } } } нужно что бы по всем почтам шла рассылка ошибка из за того что строки не разделяются и тип все почты он берет как одну
А что мешает сделать открытие не в строку а в массив, и просто в цикле перебирать массив и отправлять?