Solved

Open Outlook and email an attachment

Posted on 2011-09-27
5
452 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 300 total points
ID: 36709065
0
 
LVL 10

Assisted Solution

by:eguilherme
eguilherme earned 200 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…

821 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