Alright so pretty much I know there is a simple solution for this for the life of me though I can't find it. I want to send an attachment via mail, now I have it so that it thinks it's going to send an attachment like:
message.To.Add(recieve + "@txt.att.net");
message.From = new MailAddress(user);
message.Subject = subject;
message.Body = body;
message.Attachments.Add(new Attachment(add_photo.FileName));
client.Send(message);
You know but if add_photo(The File Dialog) is emtpy it throws and error, I tried adding a catch statement for it but the program just kinda crashes almost (not like crashes crashes but functionality wise).
Anyway, I was thinking if there is no file selected by the dialog I'll just set one myself, something really small that wouldn't even matter. So I have a picture in my resources called 'DD.png' and I would like to set it if there is no file in the dialog any ideas?
Here's what I have:
if (!string.IsNullOrEmpty(add_photo.FileName))
{
add_photo.FileName = (Path.GetFullPath(Turbo_Bomber.Properties.Resources.DD.ToString()));
}
#region Providers
if (provider == "AT&T")
{
message.To.Add(recieve + "@txt.att.net");
message.From = new MailAddress(user);
message.Subject = subject;
message.Body = body;
message.Attachments.Add(new Attachment(add_photo.FileName));
client.Send(message);
} // etc
Any ideas? Thank you guys.