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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Send mail with attachment

Send mail with attachment

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdesignsecurityhelp
6 Posts 2 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.
  • G Offline
    G Offline
    ganeshkuppuswamy
    wrote on last edited by
    #1

    In ASP.NET using C# code i am able to send mail from only gmail mail id . But i am unable to send mail from other mail ids like yahoo,zapak . I used below code to send mail . analyze the code and help me to solve using System; using System.Data; using System.Net; using System.Net.Mail; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Send_Click(object sender, EventArgs e) { MailMessage me = new MailMessage(txt_from.Text, txt_to.Text, txt_subject.Text, txt_bodyMessage.Text); SmtpClient client = new SmtpClient(txt_mailServername.Text); client.Credentials = CredentialCache.DefaultNetworkCredentials; client.EnableSsl = true; client.Credentials = new NetworkCredential(txt_from.Text, txt_password.Text); client.Send(me); } }

    ganeshk

    C 1 Reply Last reply
    0
    • G ganeshkuppuswamy

      In ASP.NET using C# code i am able to send mail from only gmail mail id . But i am unable to send mail from other mail ids like yahoo,zapak . I used below code to send mail . analyze the code and help me to solve using System; using System.Data; using System.Net; using System.Net.Mail; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Send_Click(object sender, EventArgs e) { MailMessage me = new MailMessage(txt_from.Text, txt_to.Text, txt_subject.Text, txt_bodyMessage.Text); SmtpClient client = new SmtpClient(txt_mailServername.Text); client.Credentials = CredentialCache.DefaultNetworkCredentials; client.EnableSsl = true; client.Credentials = new NetworkCredential(txt_from.Text, txt_password.Text); client.Send(me); } }

      ganeshk

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      This code does not send with an attachment. If it works with one mail server and not another, then the issue is with your mail server settings, or the server itself.

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      G 1 Reply Last reply
      0
      • C Christian Graus

        This code does not send with an attachment. If it works with one mail server and not another, then the issue is with your mail server settings, or the server itself.

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        G Offline
        G Offline
        ganeshkuppuswamy
        wrote on last edited by
        #3

        can you help me ,how to set email server for yahoo mail

        ganeshk

        C 1 Reply Last reply
        0
        • G ganeshkuppuswamy

          can you help me ,how to set email server for yahoo mail

          ganeshk

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          No, I don't use yahoo. Can you set up a mail program to read yahoo mail ? I'd expect the settings to be the same.

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          G 1 Reply Last reply
          0
          • C Christian Graus

            No, I don't use yahoo. Can you set up a mail program to read yahoo mail ? I'd expect the settings to be the same.

            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            G Offline
            G Offline
            ganeshkuppuswamy
            wrote on last edited by
            #5

            my coding working fine with gmail ids but it not so in the case of yahoo .When i am using yahoo mail id the below error i am getting System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message)

            ganeshk

            C 1 Reply Last reply
            0
            • G ganeshkuppuswamy

              my coding working fine with gmail ids but it not so in the case of yahoo .When i am using yahoo mail id the below error i am getting System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message)

              ganeshk

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Thanks for restating your problem. To restate the solution - if it works with gmail, then you either have the details wrong for yahoo, or they specifically do not support what you're doing.

              Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

              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