Very well explained, thanks. In case of multiple attachments, if I attach only ONE file and keep the other attachment option blank, it raises an exception. How to handle it?
Shakeel Ahmad .put an if(textboxAttachment1 != "") {mail.Attachment.add(textboxAttachment); } also with code like this always run under a try {risky code} catch(exception ex) {(ex.message);}
Hello, I might be really late but regardless, here's the code, it's kinda long but yah, paste it in your send button method, this worked for me, also check our channel out, we have some great videos in various topics! Code: //if there are no attachments if ((string.IsNullOrEmpty(Attachment2.Text) == true) && (string.IsNullOrEmpty(Attchment1.Text) == true)) {
All your tutorial is good but please put the code in Description!!!
What good would his video's be if he placed codes in the description ?
You're not learning anything using copy paste.
Thanks very much !
Great thanks!
Thanks bro nice vid
thanks for your help
Love your videos :D
Very well explained, thanks.
In case of multiple attachments, if I attach only ONE file and keep the other attachment option blank, it raises an exception.
How to handle it?
Shakeel Ahmad .put an if(textboxAttachment1 != "")
{mail.Attachment.add(textboxAttachment);
}
also with code like this always run under a
try
{risky code}
catch(exception ex)
{(ex.message);}
thanks a lot dude :)
thanks
can we show sending status like mail is sending while sending mail than after this mail sent msg in #12:01
since i have logged in form the application....how shuold i log out???
Hey can u show how to send attachments/files on 2 different ip addresses
Nice, but when no attachment are selected, a error shows up !!
you need to select attachment !!!
use if statement for attachment like when there is path selected than write atachment stament
Hello, I might be really late but regardless, here's the code, it's kinda long but yah, paste it in your send button method, this worked for me, also check our channel out, we have some great videos in various topics!
Code: //if there are no attachments
if ((string.IsNullOrEmpty(Attachment2.Text) == true) && (string.IsNullOrEmpty(Attchment1.Text) == true))
{
message.Subject = subjectTextBox.Text;
message.Body = BodyTextBox.Text;
}
//if all attchment textboxes are filled
if ((string.IsNullOrEmpty(Attachment2.Text) == false) && (string.IsNullOrEmpty(Attchment1.Text) ==false))
{
message.Attachments.Add(new Attachment(Attchment1.Text));
message.Attachments.Add(new Attachment(Attachment2.Text));
message.Attachments.Add(new Attachment(Attachment3.Text));
message.Attachments.Add(new Attachment(Attachment4.Text));
message.Subject = subjectTextBox.Text;
message.Body = BodyTextBox.Text;
}
//only attachement text box 1 is filled
if ((string.IsNullOrEmpty(Attchment1.Text) == false) && (string.IsNullOrEmpty(Attachment2.Text) == true ))
{
message.Attachments.Add(new Attachment(Attchment1.Text));
message.Subject = subjectTextBox.Text;
message.Body = BodyTextBox.Text;
}
//only attachment text box 2 is filed
if((string.IsNullOrEmpty(Attachment2.Text)==false)&& (string.IsNullOrEmpty(Attchment1.Text)==true))
{
message.Attachments.Add(new Attachment(Attachment2.Text));
message.Subject = subjectTextBox.Text;
message.Body = BodyTextBox.Text;
}
Hope this works for you too!
#OHOGS
the attachment is not working :/