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 8012567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:21:54+00:00 2026-06-04T19:21:54+00:00

i am using asp.net and c#.net to send the mail with large attachments(max 10mb),

  • 0

i am using asp.net and c#.net to send the mail with large attachments(max 10mb), that the reason i can convert the files, .txt,.doc,.xls file are perfectly sending but images and rar file corrupted what is the problem please give me any suggestion ,
My code is

 DataSet ds = SqlHelper.ExecuteDataset(con, "usp_GetEmailSettings", Session["UserID"].ToString());
                message.To.Add(ds.Tables[0].Rows[0]["Email"].ToString());
                message.CC.Add(ds.Tables[1].Rows[0]["EmailID"].ToString());
                message.Subject = ds.Tables[0].Rows[0]["Email_Subject"].ToString();
                message.From = new System.Net.Mail.MailAddress(ds.Tables[1].Rows[0]["EmailID"].ToString());
                message.Body = ds.Tables[0].Rows[0]["Email_Body"].ToString() +
                                       "<br/><br/> <font size='2.0em'>Submission Number : " +filename+"<br/> DBA Name : " +txtDBAName.Text + "<br/> Insured Name : " +TxtInsured.Text + "<br/> Additional Comments : " + txtcomment.Value ;
                message.IsBodyHtml = true;
                string attachId;
                System.Net.Mail.Attachment at;
 // Get the HttpFileCollection and Attach the Multiple files
                HttpFileCollection hfc = Request.Files;
                if (hfc.Count > 0)
                {
                    for (int i = 0; i < hfc.Count; i++)
                    {
                        HttpPostedFile hpf = hfc[i];
                        if (hpf.ContentLength > 0)
                        {
                            if (i == 0)
                            {
                                string[] ext = System.IO.Path.GetFileName(hpf.FileName).Split('.');
                                attachId = filename + "." + ext[1];
                                at = new System.Net.Mail.Attachment(fluuploader.FileContent, attachId);
                            }

                            else
                            {
                                string[] ext = System.IO.Path.GetFileName(hpf.FileName).Split('.');
                                attachId = filename + "(" + i + ")" + "." + ext[1];
                                at = new System.Net.Mail.Attachment(fluuploader.FileContent, attachId);
                            }
                            at.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit;
                           // at.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;                       
                            message.Attachments.Add(at);
                        }

                    }
                }
 smtp.Timeout = 9999999;
                smtp.Send(message);  

web.config my code is

<httpRuntime executionTimeout="240" maxRequestLength="20480"/>

at.TransferEncoding = System.Net.Mime.TransferEncoding.SevenBit; i can give the comment in that line doesnot send the large files but all are perfectly working but i have send the large files maximum 10mb , pls give me suggestion

  • 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-06-04T19:21:55+00:00Added an answer on June 4, 2026 at 7:21 pm

    Unless there is some black magic taking place behind the scenes, I think you need to swap out fluuploader.FileContent with hpf.InputStream. Also, I find it helps to set the Position of the InputStream to 0. Your final code inside the for loop should look something like this:

        HttpPostedFile hpf = hfc[i];
    
        if (hpf.ContentLength > 0)
        {
            hpf.InputStream.Position = 0;
    
            if (i == 0)
            {
                string[] ext = System.IO.Path.GetFileName(hpf.FileName).Split('.');
                attachId = filename + "." + ext[1];
                at = new System.Net.Mail.Attachment(hpf.InputStream, attachId);
            }
    
            else
            {
                string[] ext = System.IO.Path.GetFileName(hpf.FileName).Split('.');
                attachId = filename + "(" + i + ")" + "." + ext[1];
                at = new System.Net.Mail.Attachment(hpf.InputStream, attachId);
            }
    
            message.Attachments.Add(at);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicates: ASP.NET- Sending an e-mail how to send mail using C#? How can
I need to send mail daily using smtp and asp.net.
I am trying to send an email in ASP.NET using system.net.mail the problem is
How send mail using ASP.NET MVC? Any example for this?
I am using asp.net 3.5 and C#. I want to send mail from asp.net,
I am using asp.net and C#. I want to send mail to my user
I have a function that sends email using asp.net built in mail framework. I've
How to send a mail through mvc-3 asp.net using c#? I have to send
I'm trying to configure a dedicated server that runs ASP.NET to send mail through
How to send e-mail on ASP .Net using outlook address?? I've tried this code

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.