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 get Confirmation message when i sent pdf as mail in asp.net

How to get Confirmation message when i sent pdf as mail in asp.net

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-nettutorial
3 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.
  • N Offline
    N Offline
    naren venkata yahoo com
    wrote on last edited by
    #1

    Hi all, I am using Local reports(RDLC) for my reports in Asp.net I am have the following code in my button.I am able to send my pdf report as mail,and every thing is ok, But Problem is I am unable to produce a Confirmation message,like "Mail sent successfully".How could i change my code.Pls help me Very Urgent. Here it is skipping message.I am directly getting preview and sending mail. Private Sub BTN_ITCLETMAIL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_ITCLETMAIL.Click Dim PrefAddrid As String = DDL_COMMUADDRS.SelectedValue Dim rep As LocalReport = ReportViewer2.LocalReport Dim Balmail As New Bal_EmailForm RegisNum = Trim(LblItcRegNum.Text) Dim conn As New SqlConnection(conString) Dim da As New SqlDataAdapter Dim ds As New ReportDataSource Dim row As GridViewRow = Nothing Dim Chkcount As Integer = 0 Dim intStatus As Integer ' ''For PDF Dim warnings As Warning() = Nothing Dim streamids As String() = Nothing Dim mimeType As String = Nothing Dim encoding As String = Nothing Dim extension As String = Nothing Dim bytes As Byte() Dim FolderLocation As String 'Dim FLAG_VIE_REPORT As String '' ==================== FolderLocation = Path.GetTempPath Dim filepath As String = FolderLocation & RegisNum & "ITCLetter.pdf" Try File.Delete(filepath) Session.Contents.Remove("Error") rep.ReportPath = System.AppDomain.CurrentDomain.BaseDirectory & "ReportRdlcs\ITCLetter.rdlc" Dim cmd As SqlCommand = New SqlCommand("RepGetOnlyAdderssDataForDemandLetter", conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@RegistrationNumber", RegisNum) cmd.Parameters.AddWithValue("@PrefContactAdderss", PrefAddrid) da.SelectCommand = cmd myDataSet.Clear() da.Fill(myDataSet, "RepGetOnlyAdderssDataForDemandLetter") ds.Name = "AddressDetforDemandLetter_RepGetOnlyAdderssDataForDemandLetter" ds.Value = myDataSet.Tables(0) rep.DataSources.Add(ds) Dim params(3) As Microsoft.Reporting.WebForms.ReportParameter Dim strDemStudName As String = Nothing strDemStudName = Trim(LBL_CLIENT.Text) Dim p1 As Microsoft.Reporting.WebForms.ReportParameter

    K 1 Reply Last reply
    0
    • N naren venkata yahoo com

      Hi all, I am using Local reports(RDLC) for my reports in Asp.net I am have the following code in my button.I am able to send my pdf report as mail,and every thing is ok, But Problem is I am unable to produce a Confirmation message,like "Mail sent successfully".How could i change my code.Pls help me Very Urgent. Here it is skipping message.I am directly getting preview and sending mail. Private Sub BTN_ITCLETMAIL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BTN_ITCLETMAIL.Click Dim PrefAddrid As String = DDL_COMMUADDRS.SelectedValue Dim rep As LocalReport = ReportViewer2.LocalReport Dim Balmail As New Bal_EmailForm RegisNum = Trim(LblItcRegNum.Text) Dim conn As New SqlConnection(conString) Dim da As New SqlDataAdapter Dim ds As New ReportDataSource Dim row As GridViewRow = Nothing Dim Chkcount As Integer = 0 Dim intStatus As Integer ' ''For PDF Dim warnings As Warning() = Nothing Dim streamids As String() = Nothing Dim mimeType As String = Nothing Dim encoding As String = Nothing Dim extension As String = Nothing Dim bytes As Byte() Dim FolderLocation As String 'Dim FLAG_VIE_REPORT As String '' ==================== FolderLocation = Path.GetTempPath Dim filepath As String = FolderLocation & RegisNum & "ITCLetter.pdf" Try File.Delete(filepath) Session.Contents.Remove("Error") rep.ReportPath = System.AppDomain.CurrentDomain.BaseDirectory & "ReportRdlcs\ITCLetter.rdlc" Dim cmd As SqlCommand = New SqlCommand("RepGetOnlyAdderssDataForDemandLetter", conn) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@RegistrationNumber", RegisNum) cmd.Parameters.AddWithValue("@PrefContactAdderss", PrefAddrid) da.SelectCommand = cmd myDataSet.Clear() da.Fill(myDataSet, "RepGetOnlyAdderssDataForDemandLetter") ds.Name = "AddressDetforDemandLetter_RepGetOnlyAdderssDataForDemandLetter" ds.Value = myDataSet.Tables(0) rep.DataSources.Add(ds) Dim params(3) As Microsoft.Reporting.WebForms.ReportParameter Dim strDemStudName As String = Nothing strDemStudName = Trim(LBL_CLIENT.Text) Dim p1 As Microsoft.Reporting.WebForms.ReportParameter

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

      do one thing see the code and match your code (code is in C# syntax). //code public static bool SendMail(string FromEmail, string FromName, string ToEmails, string MailBody, string Subject, string CcEmails, string BccEmails, bool IsBodyHtml) { try { System.Net.Mail.MailMessage objMail = new System.Net.Mail.MailMessage(); //Mail From Field if (!String.IsNullOrEmpty(FromName)) { objMail.From = new MailAddress(FromEmail, FromName); } else { objMail.From = new MailAddress(FromEmail); } //Mail To Field if (!String.IsNullOrEmpty(ToEmails)) { objMail.To.Add(ToEmails); } //Mail Cc Field if (!String.IsNullOrEmpty(CcEmails)) { objMail.CC.Add(CcEmails); } //Mail Bcc Field if (!String.IsNullOrEmpty(BccEmails)) { objMail.Bcc.Add(BccEmails); } //Mail Subject Field objMail.Subject = Subject; //Mail Body Field objMail.Body = MailBody; objMail.IsBodyHtml = IsBodyHtml; try { SmtpClient smtp1 = new SmtpClient(); smtp1.Send(objMail); return true; } catch (Exception ex) { //HttpContext.Current.Response.Write(ex.Message.ToString()); return false; } } catch (Exception ex) { string mess = ex.Message.ToString(); return false; } } // now in your code if its return true then fire your script. it will show the message as if your script is without error.

      Regards Keyur Satyadev

      N 1 Reply Last reply
      0
      • K keyur satyadev

        do one thing see the code and match your code (code is in C# syntax). //code public static bool SendMail(string FromEmail, string FromName, string ToEmails, string MailBody, string Subject, string CcEmails, string BccEmails, bool IsBodyHtml) { try { System.Net.Mail.MailMessage objMail = new System.Net.Mail.MailMessage(); //Mail From Field if (!String.IsNullOrEmpty(FromName)) { objMail.From = new MailAddress(FromEmail, FromName); } else { objMail.From = new MailAddress(FromEmail); } //Mail To Field if (!String.IsNullOrEmpty(ToEmails)) { objMail.To.Add(ToEmails); } //Mail Cc Field if (!String.IsNullOrEmpty(CcEmails)) { objMail.CC.Add(CcEmails); } //Mail Bcc Field if (!String.IsNullOrEmpty(BccEmails)) { objMail.Bcc.Add(BccEmails); } //Mail Subject Field objMail.Subject = Subject; //Mail Body Field objMail.Body = MailBody; objMail.IsBodyHtml = IsBodyHtml; try { SmtpClient smtp1 = new SmtpClient(); smtp1.Send(objMail); return true; } catch (Exception ex) { //HttpContext.Current.Response.Write(ex.Message.ToString()); return false; } } catch (Exception ex) { string mess = ex.Message.ToString(); return false; } } // now in your code if its return true then fire your script. it will show the message as if your script is without error.

        Regards Keyur Satyadev

        N Offline
        N Offline
        naren venkata yahoo com
        wrote on last edited by
        #3

        Hi,Thanks for reply, I am able to view message in other situations like inserting or updatating tables. I am unable to get message in this particular scenario,when i render a rdlc report into pdf. Regards, Naren

        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