Resolved: The parameter 'from' cannot be an empty string.

Stimulsoft Reports.WEB discussion
Post Reply
JohnW
Posts: 116
Joined: Mon Nov 20, 2017 8:29 pm

Resolved: The parameter 'from' cannot be an empty string.

Post by JohnW »

I now get this error when trying to email a report. It occur after sub runs. So it is happening outside of the code I have created. I am not sure why its showing since its a Net.Mail.MailMessage error.I am not using that to send the the reports.

[ArgumentException: The parameter 'from' cannot be an empty string.
Parameter name: from]
System.Net.Mail.MailMessage..ctor(String from, String to)

Here is the code as it is today:

Code: Select all

    Protected Sub StiWebViewer1_EmailReport(ByVal sender As Object, ByVal e As StiReportDataEventArgs)
        Dim format As StiExportFormat
        Dim report As StiReport = e.Report
        Dim settings As StiExportSettings
        Dim options As StiEmailOptions
        options = New StiEmailOptions
        format = StiExportFormat.Pdf

        Try

            options.AddressFrom = "xxxxxx@gmail.com"
            options.Host = "smtp.gmail.com"
            options.Port = 465
            options.UserName = "xxxxxxx@gmail.com"
            options.Password = "xxxxxxxx"

        Catch ex As Exception
            Dim strmsg As String = ex.Message

        End Try
        'Should be filled here

    End Sub
Last edited by JohnW on Mon Dec 18, 2017 2:29 pm, edited 1 time in total.
JohnW
Posts: 116
Joined: Mon Nov 20, 2017 8:29 pm

Resolved: The parameter 'from' cannot be an empty string.

Post by JohnW »

I have tracked the error. As expected it was my own doing. I tried to manually convert the sample code C# to VB.net. I missed something when I did that. I set the event incorrectly.

In case there are other developers who have a similar experience the sub should be called like this

Protected Sub StiWebViewer1_EmailReport(sender As Object, e As StiEmailReportEventArgs) Handles StiWebViewer1.EmailReport

I originally did not include the "Handles...." language. My mistake and I embarrassed to say how many hours I spent tracking the problem. Now to sort out some smtp server permissions and life will take a step forward.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Resolved: The parameter 'from' cannot be an empty strin

Post by HighAley »

Hello, John.

Thank you for your solution.
Let us know if you need our help.

Thank you.
Post Reply