Solved

Open Outlook and email an attachment

Posted on 2011-09-27
5
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

622 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