Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open Outlook and email an attachment

Posted on 2011-09-27
5
Medium Priority
?
464 Views
Last Modified: 2012-08-13
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

0
Comment
Question by:lrbrister
  • 2
  • 2
5 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1200 total points
ID: 36709065
0
 
LVL 10

Assisted Solution

by:eguilherme
eguilherme earned 800 total points
ID: 36709076
you could use office interop for that.. but i dont recommend it.. you dont have access to Exchange/SMTP ?

Outlook interop tutorial:

http://www.dreamincode.net/forums/topic/60975-office-automation/
0
 

Author Comment

by:lrbrister
ID: 36709116
Thanks guys...two great answers a minute apart.

Any problem with a 300/200 split with the nod to emoreau: for being forst?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 36709142
I have no problem. It is your question/points.
0
 

Author Closing Comment

by:lrbrister
ID: 36709170
Great
Thanks guys
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Screencast - Getting to Know the Pipeline

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question