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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:35:16+00:00 2026-06-17T10:35:16+00:00

I am trying to send a mail, in this case a gridview to a

  • 0

I am trying to send a mail, in this case a gridview to a specified folder on my machine as to be able to view the message. I am thus sending the mail but it is not ending up in the folder. How can I do this?

I added this to web.config:

<system.net>
<mailSettings >
  <smtp deliveryMethod="Network" from="ArianG@lr.co.za">
    <network host="staging.itmaniax.co.za"/>
    <specifiedPickupDirectory pickupDirectoryLocation="C:\testdump\emaildump\"/>
  </smtp>
</mailSettings>

This is my code for sending the gridview. (I presume I do not need SmtpClient as I do not want to connect to a port, either 25 or 587) :

private void MailReport()
{
    //*****************************************************
    string to = "arianul@gmail.com";
    string From = "ArianG@lr.co.za";
    string subject = "Report";
    string Body = "Good morning, Please view attachment<br> Plz Check d Attachment <br><br>";

    Body += GridViewToHtml(GridView1);

    Body += "<br><br>Regards,<br>Arian Geryts(ITManiax)";
    bool send = sendMail(to, From, subject, Body);

    if (send == true)
    {
        string CloseWindow = "alert('Mail Sent Successfully!');";
        ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", CloseWindow, true);
    }
    else
    {
        string CloseWindow = "alert('Problem in Sending mail...try later!');";
        ClientScript.RegisterStartupScript(this.GetType(), "CloseWindow", CloseWindow, true);
     }
    //*****************************************************

}

public bool sendMail(string to, string from, string subject, string body)
{
    bool k = false;
    try
    {
        MailMessage msg = new MailMessage(from, to);
        msg.Subject = subject;

        AlternateView view;
        SmtpClient client;
        StringBuilder msgText = new StringBuilder();
        view = AlternateView.CreateAlternateViewFromString(msgText.ToString(), null, "text/html");
        msg.AlternateViews.Add(view);
        msgText.Append(" <html><body><br></body></html> <br><br><br>  " + body);

        //*****
        /*client = new SmtpClient("smtp.gmail.com", 25);
        client.Host = "staging.itmaniax.co.za";
        client.Port = 25;

        //****
        client.EnableSsl = true;
        client.Send(msg);*/

        k = true;     
    }
  • 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-17T10:35:17+00:00Added an answer on June 17, 2026 at 10:35 am

    Change your mail Setting in web.config to:

      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\smtp" />
    

    This should do the trick. Alternativly you could change the setting via tha IIS gui, after you deployed the solution.

    Kind regards.

    /edit: of course you need a smtp client. The program has to fire the email message out to the smtp server. The message just gets picked up by IIS and stuffed into a folder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to send a mail from a asp.net script, but im getting this
i'm trying to send mail in this way: Properties props = new Properties(); props.setProperty(mail.transport.protocol,
I am trying to send an e-mail from a cron using CakePHP shell but
I'm trying to send an e-mail with ZendMail ( this simple script sums it
I am trying to send mail from localhost.. and on doing this i have
I am trying to send mail using mail templates. To do this I want
I'm using smtp (c#)and trying to send mail to group id(official id) but its
this is my mail script trying to send mail from my server. <?php $subject
I'm trying to send out mail using Google's SMTP in combination with PHPMailer, but
I am trying to get this simple php mail script to send mail to

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.