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. Email

Email

Scheduled Pinned Locked Moved ASP.NET
comsysadmin
10 Posts 3 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.
  • N Offline
    N Offline
    NET India
    wrote on last edited by
    #1

    Can anybody let me know the code i've given below is sufficient or not for sending E-Mail on the net If yes then i would like to tell u that it is not working properly It is just sending the message "Mail Sent Successfully" as i used for success message but i'm not receiving the mail at my id as i've defined "manoj.manojbisht@gmail.com" But i'm still confused about "SMTP SERVER" i've kept it blank. Should i use something else if yes plz let me know.................................................................................................................................................... MailMessage mail=new MailMessage(); mail.To="manoj.manojbisht@gmail.com"; mail.From="msb1984_620@yahoo.com"; mail.Subject="Manoj Bisht"; mail.Priority=MailPriority.High; mail.Body="Hello How R U"; try { SmtpMail.SmtpServer=""; SmtpMail.Send(mail); //Response.Write("Mail Sent Successfully"); lblMsg.Text="Mail Sent Succesffully"; lblMsg.ForeColor=Color.DarkBlue; } catch(Exception ex) { Response.Write("Message Failed"); }

    S F 2 Replies Last reply
    0
    • N NET India

      Can anybody let me know the code i've given below is sufficient or not for sending E-Mail on the net If yes then i would like to tell u that it is not working properly It is just sending the message "Mail Sent Successfully" as i used for success message but i'm not receiving the mail at my id as i've defined "manoj.manojbisht@gmail.com" But i'm still confused about "SMTP SERVER" i've kept it blank. Should i use something else if yes plz let me know.................................................................................................................................................... MailMessage mail=new MailMessage(); mail.To="manoj.manojbisht@gmail.com"; mail.From="msb1984_620@yahoo.com"; mail.Subject="Manoj Bisht"; mail.Priority=MailPriority.High; mail.Body="Hello How R U"; try { SmtpMail.SmtpServer=""; SmtpMail.Send(mail); //Response.Write("Mail Sent Successfully"); lblMsg.Text="Mail Sent Succesffully"; lblMsg.ForeColor=Color.DarkBlue; } catch(Exception ex) { Response.Write("Message Failed"); }

      S Offline
      S Offline
      Sathesh Sakthivel
      wrote on last edited by
      #2

      Pls check the Spam Folder.

      Regards, Satips.:rose:

      N 1 Reply Last reply
      0
      • S Sathesh Sakthivel

        Pls check the Spam Folder.

        Regards, Satips.:rose:

        N Offline
        N Offline
        NET India
        wrote on last edited by
        #3

        SPAM folder is also empty

        S 1 Reply Last reply
        0
        • N NET India

          SPAM folder is also empty

          S Offline
          S Offline
          Sathesh Sakthivel
          wrote on last edited by
          #4

          Apply Break Point and check it whether it is blocked by your ISP or the code.

          Regards, Satips.:rose:

          1 Reply Last reply
          0
          • N NET India

            Can anybody let me know the code i've given below is sufficient or not for sending E-Mail on the net If yes then i would like to tell u that it is not working properly It is just sending the message "Mail Sent Successfully" as i used for success message but i'm not receiving the mail at my id as i've defined "manoj.manojbisht@gmail.com" But i'm still confused about "SMTP SERVER" i've kept it blank. Should i use something else if yes plz let me know.................................................................................................................................................... MailMessage mail=new MailMessage(); mail.To="manoj.manojbisht@gmail.com"; mail.From="msb1984_620@yahoo.com"; mail.Subject="Manoj Bisht"; mail.Priority=MailPriority.High; mail.Body="Hello How R U"; try { SmtpMail.SmtpServer=""; SmtpMail.Send(mail); //Response.Write("Mail Sent Successfully"); lblMsg.Text="Mail Sent Succesffully"; lblMsg.ForeColor=Color.DarkBlue; } catch(Exception ex) { Response.Write("Message Failed"); }

            F Offline
            F Offline
            FishiFishi
            wrote on last edited by
            #5

            try { string msgBody = ""; string configToAddresses = ""; string[] toAddressesArray; configToAddresses = ConfigurationManager.AppSettings["MSG_REQUEST_TO_EMAIL_ADDRESS"].Trim(); MailMessage msg = new MailMessage(); msg.From = new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_FROM_EMAIL_ADDRESS"].Trim()); toAddressesArray = configToAddresses.Split(';'); // Add to Addresses in email foreach (string toAddress in toAddressesArray) { msg.To.Add(new MailAddress(toAddress)); } if (ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim().Length > 0) { msg.CC.Add(new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim())); } msg.Subject = ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_SUBJECT"].Trim() + " " + DateTime.Now; msgBody = ConfigurationManager.AppSettings["MSG_REQUEST_SALUTE_EMAIL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_START"].Trim() + " " + this.txtName.Text.Trim() + " (" + this.txtEmail.Text.Trim() + ")"; if (this.txtOrganization.Text.Trim().Length > 0) { msgBody += " of " + this.txtOrganization.Text.Trim(); } msgBody += " on " + DateTime.Now + ". "; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_MIDDLE"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_URL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM"].Trim() + "\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL"].Trim(); msg.Body = msgBody; SmtpClient client = new SmtpClient(); client.Host = ConfigurationManager.AppSettings["SMTP_HOST"]; client.Port = int.Parse(ConfigurationManager.AppSettings["SMTP_PORT"]); client.Send(msg); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { ConfigurationManager.AppSettings["DEFAULT_MESSAGE"] = ex.ToString(); Resp

            N 1 Reply Last reply
            0
            • F FishiFishi

              try { string msgBody = ""; string configToAddresses = ""; string[] toAddressesArray; configToAddresses = ConfigurationManager.AppSettings["MSG_REQUEST_TO_EMAIL_ADDRESS"].Trim(); MailMessage msg = new MailMessage(); msg.From = new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_FROM_EMAIL_ADDRESS"].Trim()); toAddressesArray = configToAddresses.Split(';'); // Add to Addresses in email foreach (string toAddress in toAddressesArray) { msg.To.Add(new MailAddress(toAddress)); } if (ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim().Length > 0) { msg.CC.Add(new MailAddress(ConfigurationManager.AppSettings["MSG_REQUEST_CC_EMAIL_ADDRESS"].Trim())); } msg.Subject = ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_SUBJECT"].Trim() + " " + DateTime.Now; msgBody = ConfigurationManager.AppSettings["MSG_REQUEST_SALUTE_EMAIL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_START"].Trim() + " " + this.txtName.Text.Trim() + " (" + this.txtEmail.Text.Trim() + ")"; if (this.txtOrganization.Text.Trim().Length > 0) { msgBody += " of " + this.txtOrganization.Text.Trim(); } msgBody += " on " + DateTime.Now + ". "; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_EMAIL_BODY_MIDDLE"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_URL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL"].Trim() + "\r\n\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM"].Trim() + "\r\n"; msgBody += ConfigurationManager.AppSettings["MSG_REQUEST_SIGNATURE_EMAIL_TEAM_URL"].Trim(); msg.Body = msgBody; SmtpClient client = new SmtpClient(); client.Host = ConfigurationManager.AppSettings["SMTP_HOST"]; client.Port = int.Parse(ConfigurationManager.AppSettings["SMTP_PORT"]); client.Send(msg); } catch (System.Threading.ThreadAbortException ex) { } catch (Exception ex) { ConfigurationManager.AppSettings["DEFAULT_MESSAGE"] = ex.ToString(); Resp

              N Offline
              N Offline
              NET India
              wrote on last edited by
              #6

              Sir the code u sent me is it running properly i mean. Will i have to make any changes in web.config file If yes plz let me know I'm waiting for response by ur side

              F 2 Replies Last reply
              0
              • N NET India

                Sir the code u sent me is it running properly i mean. Will i have to make any changes in web.config file If yes plz let me know I'm waiting for response by ur side

                F Offline
                F Offline
                FishiFishi
                wrote on last edited by
                #7

                yes, yes, its working properly, but you have to define the msgs in web.config

                Regards, Qaiser Nadeem

                1 Reply Last reply
                0
                • N NET India

                  Sir the code u sent me is it running properly i mean. Will i have to make any changes in web.config file If yes plz let me know I'm waiting for response by ur side

                  F Offline
                  F Offline
                  FishiFishi
                  wrote on last edited by
                  #8

                  should i send u the web msgs????

                  Regards, Qaiser Nadeem

                  N 1 Reply Last reply
                  0
                  • F FishiFishi

                    should i send u the web msgs????

                    Regards, Qaiser Nadeem

                    N Offline
                    N Offline
                    NET India
                    wrote on last edited by
                    #9

                    yes plz send the web.config code too

                    F 1 Reply Last reply
                    0
                    • N NET India

                      yes plz send the web.config code too

                      F Offline
                      F Offline
                      FishiFishi
                      wrote on last edited by
                      #10

                      if u still have any questions then plz come on q.nadeem@hotmail.com

                      Regards, Qaiser Nadeem

                      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