Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to send email?

How to send email?

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomsysadminwindows-admin
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shahdat Hosain
    wrote on last edited by
    #1

    I want to send email from local host. I have setuped IIS and SMTP sevver.And configure the Default SMTP Virtual Server w.r.t "Email System Using ASP.NET" and other codeproject articles. Then I debug the cobe and I gave Following information From:127.0.0.1 To :shahdat45ict@yahoo.com Subject:afsd cc:fs Bcc:ad After that, I Clicked on send botton Level show Your email has been sent successfully-Thank You. But actually massage could not send. What can I do?

    shahdat

    C 1 Reply Last reply
    0
    • S Shahdat Hosain

      I want to send email from local host. I have setuped IIS and SMTP sevver.And configure the Default SMTP Virtual Server w.r.t "Email System Using ASP.NET" and other codeproject articles. Then I debug the cobe and I gave Following information From:127.0.0.1 To :shahdat45ict@yahoo.com Subject:afsd cc:fs Bcc:ad After that, I Clicked on send botton Level show Your email has been sent successfully-Thank You. But actually massage could not send. What can I do?

      shahdat

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      MD. SHAHDAT HOSAIN wrote:

      But actually massage could not send. What can I do?

      Double check IIS. Is it actually pushing the emails out on the internet, or is it just storing them somewhere. You'll have some folders in C:\inetpub\... somewhere for the SMTP server (if you are using the default configuration). Are your emails in there? You could also show us your code. It might be giving a false positive.

      *Developer Day Scotland - Free community conference Delegate Registration Open

      S 1 Reply Last reply
      0
      • C Colin Angus Mackay

        MD. SHAHDAT HOSAIN wrote:

        But actually massage could not send. What can I do?

        Double check IIS. Is it actually pushing the emails out on the internet, or is it just storing them somewhere. You'll have some folders in C:\inetpub\... somewhere for the SMTP server (if you are using the default configuration). Are your emails in there? You could also show us your code. It might be giving a false positive.

        *Developer Day Scotland - Free community conference Delegate Registration Open

        S Offline
        S Offline
        Shahdat Hosain
        wrote on last edited by
        #3

        Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me

        shahdat

        A K 2 Replies Last reply
        0
        • S Shahdat Hosain

          Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me

          shahdat

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          MD. SHAHDAT HOSAIN wrote:

          Note: What's address should be provided in From: text box?Is essential or not?

          Here You Go

          MD. SHAHDAT HOSAIN wrote:

          How can I check IIS send is pushing the emails out on the internet?

          You can have a look on SMTP response code.

          cheers, Abhijit CodeProject MVP

          S 1 Reply Last reply
          0
          • S Shahdat Hosain

            Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me

            shahdat

            K Offline
            K Offline
            kishorgh
            wrote on last edited by
            #5

            string SmtpServerIP = "UR SMPTP IP"; if (SmtpServerIP != "") { SmtpClient smtpClient = new SmtpClient(SmtpServerIP); smtpClient.Send(Email); }

            1 Reply Last reply
            0
            • A Abhijit Jana

              MD. SHAHDAT HOSAIN wrote:

              Note: What's address should be provided in From: text box?Is essential or not?

              Here You Go

              MD. SHAHDAT HOSAIN wrote:

              How can I check IIS send is pushing the emails out on the internet?

              You can have a look on SMTP response code.

              cheers, Abhijit CodeProject MVP

              S Offline
              S Offline
              Shahdat Hosain
              wrote on last edited by
              #6

              According to Ur suggestion I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue; 1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code. 2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ; 3. Please help me!; public void CreateCopyMessage(string server) { MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller"); MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com MailMessage message = new MailMessage(from, to); // message.Subject = "Using the SmtpClient class."; message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; // Add a carbon copy recipient. MailAddress copy = new MailAddress("Notification_List@contoso.com"); message.CC.Add(copy); SmtpClient client = new SmtpClient(server); // Include credentials if the server requires them. client.Credentials= client.Credentials = CredentialCache.DefaultNetworkCredentials; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.", to.Address, client.Host); try { client.Send(message); lblMessage.Text = "Message successfully sent"; } catch (Exception ex) { Console.WriteLine("Exception caught in CreateCopyMessage(): {0}", ex.ToString()); } }

              shahdat

              modified on Tuesday, April 14, 2009 11:09 AM

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups