Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7494269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:25:06+00:00 2026-05-29T17:25:06+00:00

Im trying to send a Docx file via this form that I made, the

  • 0

Im trying to send a Docx file via this form that I made, the email sends fine.
but the docx file gets back corrupted..
this is my backgroudn code:

‘Add the namespace for the email-related classes
Imports System.Net.Mail

Partial Class SendAttachment
Inherits System.Web.UI.Page

Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendEmail.Click
    'Make sure a file has been uploaded
    If String.IsNullOrEmpty(AttachmentFile.FileName) OrElse AttachmentFile.PostedFile Is Nothing Then
        Throw New ApplicationException("Egad, a file wasn't uploaded... you should probably use more graceful error handling than this, though...")
    End If

    ' UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
    Const ToAddress As String = "pelleg@shakuff.co.il"

    '(1) Create the MailMessage instance
    Dim mm As New MailMessage(UsersEmail.Text, ToAddress)

    '(2) Assign the MailMessage's properties
    mm.Subject = "שלוחת קורות חיים"
    mm.Body = Body.Text
    mm.IsBodyHtml = False

    'Attach the file
    mm.Attachments.Add(New Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName))

    '(3) Create the SmtpClient object
    Dim smtp As New SmtpClient

    '(4) Send the MailMessage (will use the Web.config settings)
    smtp.Send(mm)


    'Show the EmailSentForm Panel and hide the EmailForm Panel
    EmailSentForm.Visible = True
    EmailForm.Visible = False
End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
        'On the first page load, hide the EmailSentForm Panel
        EmailSentForm.Visible = False
    End If
End Sub

End Class

its the sendemail.aspx.vb file.
any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T17:25:18+00:00Added an answer on May 29, 2026 at 5:25 pm

    totally off the top of my head, but try setting:

    AttachmentFile.PostedFile.InputStream.Position = 0  
    

    before you call:

    'Attach the file     mm.Attachments.Add(New Attachment(AttachmentFile.PostedFile.InputStream, AttachmentFile.FileName)) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to send an email via mail command in linux c++, but
I'm trying to send an email in Java but when I read the body
I am trying to send an email from a site I am building, but
I'm trying to send an email merging one document (.docx) with a contacts database
I am trying to send an email containing a file attachment created by the
Im trying to send an email to multiple addresses, so I wrote function that
Im trying to send a mail from a asp.net script, but im getting this
I am trying to send email via System.Net.Mail. On clicking send I am getting
Trying to send a PHP email the easy way but I cannot work out
Trying to send a html email via mail(), however gmail just displays the email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.