IhaveaquestionmyprogramconsistsofsendingemailwithattachmentsbutsometimeswhenIdonotwanttosendanemailwithattachmentsgivemeanerror
Can anyone help?
I can send email with attachments without problems but no attachments do not work
code:
private void button4_Click(object sender, EventArgs e){
SmtpClient cliente = new SmtpClient();
MailMessage msg = new MailMessage();
msg.Attachments.Add(new Attachment(Anexostxt.Text));
msg.Attachments.Add(new Attachment(anexos2.Text));
}
private void button6_Click(object sender, EventArgs e){
OpenFileDialog dlg = new OpenFileDialog();
if(dlg.ShowDialog()==DialogResult.OK){
string picpath = dlg.FileName.ToString();
Anexostxt.Text = picpath;
}
}
Error Additional information: The parameter 'fileName' can not be an empty string.