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. Cann't send email and attachment thru asp.net 2003 using smptserver="localhost" [modified]

Cann't send email and attachment thru asp.net 2003 using smptserver="localhost" [modified]

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netgraphicsdesignsysadmin
4 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.
  • M Offline
    M Offline
    micydon
    wrote on last edited by
    #1

    Hi My requirement is i have an application form which has entries like name,dob,qualification,exp and upload resume(file field). when somebody fill this form, upload his resume and press submit ,i want these details and resume to get in my yahoomails inbox. but when i try this with local host it doesn't work i hve given the ip address in default smptservers relay button. i am using asp.net 2003 can anybody pls help me why i am not getting this correctly.Below i am giving the code i hve used Imports System Imports System.Data.OleDb Imports System.web Imports System.IO Imports System.Web.Mail Imports System.Web.SessionState Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Function FncSubmit() Dim szSQL As String Dim objdr As OleDbDataReader Dim icnt As Integer Dim sapplnno As String Dim szFileBiodata As String Dim szfile As String Dim iapplnno As Integer Dim attach1 As String Dim objEmail As New MailMessage objEmail.To = "abc@yahoo.co.in" objEmail.From = txtEmail.Text objEmail.Subject = txtName.Text & "," & txtQualif.Text & ", " & txtExp.Text objEmail.Body = "hi" If Not file1.PostedFile Is Nothing Then Dim attFile As HttpPostedFile = file1.PostedFile Dim attachFileLength As Integer = attFile.ContentLength If attachFileLength > 0 Then szfile = Path.GetFileName(file1.PostedFile.FileName) file1.PostedFile.SaveAs(Server.MapPath(szfile)) Dim attach As MailAttachment = New MailAttachment(Server.MapPath(szfile)) ' Attach the Newly created email attachment */ attach1 = szfile objEmail.Attachments.Add(attach) End If End If objEmail.Priority = MailPriority.High SmtpMail.SmtpServer ="localhost" Try SmtpMail.Send(objEmail) 'MessageBox.Show("Your feedback has been submitted.") MessageBox.Show("Your application is submitted") Catch exc As Exception MessageBox.Show("Failed to submit your feedback: ") 'MessageBox.Show(exc.ToString()) Response.Write(exc.ToString()) End Try If attach1 <> "" Then

    L 1 Reply Last reply
    0
    • M micydon

      Hi My requirement is i have an application form which has entries like name,dob,qualification,exp and upload resume(file field). when somebody fill this form, upload his resume and press submit ,i want these details and resume to get in my yahoomails inbox. but when i try this with local host it doesn't work i hve given the ip address in default smptservers relay button. i am using asp.net 2003 can anybody pls help me why i am not getting this correctly.Below i am giving the code i hve used Imports System Imports System.Data.OleDb Imports System.web Imports System.IO Imports System.Web.Mail Imports System.Web.SessionState Imports System.Collections Imports System.ComponentModel Imports System.Drawing Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Function FncSubmit() Dim szSQL As String Dim objdr As OleDbDataReader Dim icnt As Integer Dim sapplnno As String Dim szFileBiodata As String Dim szfile As String Dim iapplnno As Integer Dim attach1 As String Dim objEmail As New MailMessage objEmail.To = "abc@yahoo.co.in" objEmail.From = txtEmail.Text objEmail.Subject = txtName.Text & "," & txtQualif.Text & ", " & txtExp.Text objEmail.Body = "hi" If Not file1.PostedFile Is Nothing Then Dim attFile As HttpPostedFile = file1.PostedFile Dim attachFileLength As Integer = attFile.ContentLength If attachFileLength > 0 Then szfile = Path.GetFileName(file1.PostedFile.FileName) file1.PostedFile.SaveAs(Server.MapPath(szfile)) Dim attach As MailAttachment = New MailAttachment(Server.MapPath(szfile)) ' Attach the Newly created email attachment */ attach1 = szfile objEmail.Attachments.Add(attach) End If End If objEmail.Priority = MailPriority.High SmtpMail.SmtpServer ="localhost" Try SmtpMail.Send(objEmail) 'MessageBox.Show("Your feedback has been submitted.") MessageBox.Show("Your application is submitted") Catch exc As Exception MessageBox.Show("Failed to submit your feedback: ") 'MessageBox.Show(exc.ToString()) Response.Write(exc.ToString()) End Try If attach1 <> "" Then

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Why did you assign both IP and localhost to SmtpMail.SmtpServer in the line SmtpMail.SmtpServer ="localhost"' "127.0.0.1"?. Use either one. Also post the error message, if this is not working.

      M 1 Reply Last reply
      0
      • L Lost User

        Why did you assign both IP and localhost to SmtpMail.SmtpServer in the line SmtpMail.SmtpServer ="localhost"' "127.0.0.1"?. Use either one. Also post the error message, if this is not working.

        M Offline
        M Offline
        micydon
        wrote on last edited by
        #3

        i hve gven only local host. there is no error message shown but iam not getting email in my inbox

        K 1 Reply Last reply
        0
        • M micydon

          i hve gven only local host. there is no error message shown but iam not getting email in my inbox

          K Offline
          K Offline
          keyur satyadev
          wrote on last edited by
          #4

          use smtp.net.mail make object of SmtpClient smtp1 = new SmtpClient(); smtp1.Send(objMail); objMail containt the details of Mailt TO, Mail From, Body etc . use this u can easily send the mail. Regards Keyur

          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