Link to home
Start Free TrialLog in
Avatar of Larry Brister
Larry BristerFlag for United States of America

asked on

Open Outlook and email an attachment

I am using Telerik Reporting for my Web Application.

With my attached code I can send an email with the report as an attachment.

Is there any way to open MS Outlook and send the attachment?
Private Sub MailReport(report As Telerik.Reporting.Report, from As String, [to] As String, subject As String, body As String)
	Dim reportProcessor As New ReportProcessor()
	Dim result As RenderingResult = reportProcessor.RenderReport("PDF", report, Nothing)
	Dim ms As New MemoryStream(result.DocumentBytes)
	ms.Position = 0
	Dim attachment As New Attachment(ms, report.Name + ".pdf")
	Dim msg As New MailMessage(from, [to], subject, body)
	msg.Attachments.Add(attachment)
	'smtp host is the name or IP of the host computer used for sending the email
	Dim smtpHost As String = "255.255.255.0"
	Dim client As New SmtpClient(smtpHost)
	client.Send(msg)
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Larry Brister

ASKER

Thanks guys...two great answers a minute apart.

Any problem with a 300/200 split with the nod to emoreau: for being forst?
I have no problem. It is your question/points.
Great
Thanks guys