C# Tutorial 76: Send Attachment / Multiple attachment file in email using C#

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 21

  • @NazrulYo
    @NazrulYo 11 ปีที่แล้ว +5

    All your tutorial is good but please put the code in Description!!!

    • @donboss839
      @donboss839 10 ปีที่แล้ว +5

      What good would his video's be if he placed codes in the description ?
      You're not learning anything using copy paste.

  • @tedbobit2762
    @tedbobit2762 5 ปีที่แล้ว

    Thanks very much !

  • @manjeetnandal1
    @manjeetnandal1 5 ปีที่แล้ว

    Great thanks!

  • @christiantorres7589
    @christiantorres7589 6 ปีที่แล้ว

    Thanks bro nice vid

  • @udaygudivaka8849
    @udaygudivaka8849 8 ปีที่แล้ว

    thanks for your help

  • @kalmanroland
    @kalmanroland 8 ปีที่แล้ว

    Love your videos :D

  • @Shakeel-Soft
    @Shakeel-Soft 8 ปีที่แล้ว

    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?

    • @philipm1896
      @philipm1896 8 ปีที่แล้ว +1

      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);}

  • @jamik7635
    @jamik7635 8 ปีที่แล้ว

    thanks a lot dude :)

  • @jamik7635
    @jamik7635 8 ปีที่แล้ว

    thanks

  • @codingknowledge8183
    @codingknowledge8183 7 ปีที่แล้ว

    can we show sending status like mail is sending while sending mail than after this mail sent msg in #12:01

  • @kishorekaturi4137
    @kishorekaturi4137 11 ปีที่แล้ว

    since i have logged in form the application....how shuold i log out???

  • @nusrat768
    @nusrat768 5 ปีที่แล้ว

    Hey can u show how to send attachments/files on 2 different ip addresses

  • @ivodonckers25
    @ivodonckers25 8 ปีที่แล้ว +1

    Nice, but when no attachment are selected, a error shows up !!
    you need to select attachment !!!

    • @codingknowledge8183
      @codingknowledge8183 7 ปีที่แล้ว

      use if statement for attachment like when there is path selected than write atachment stament

    • @lolzlyfe7237
      @lolzlyfe7237 3 ปีที่แล้ว

      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!

  • @brettsullivan4025
    @brettsullivan4025 10 ปีที่แล้ว

    #OHOGS

  • @tasnimalfaridi3955
    @tasnimalfaridi3955 9 ปีที่แล้ว

    the attachment is not working :/