Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports System.IO
Imports System.Net.Mail
Imports System.Drawing
Imports System.Collections
Imports DevExpress.XtraReports.UI
<NavigationItem(False), CreatableItem(False)> _
Public Class EmailSender
    Inherits BaseObject
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Sub Sendmail() '---- Nem működ még csak próba adatokkal lett megcsinálva
        Try
            ' Create a new report.                
            Dim Report As New XtraReport1()
            ' Create a new memory stream and export the report into it as PDF.
            Dim Mem As New MemoryStream()
            Report.ExportToPdf(Mem)
            ' Create a new attachment and put the PDF report into it.
            Mem.Seek(0, System.IO.SeekOrigin.Begin)
            Dim Att = New Attachment(Mem, "TestReport.pdf", "application/pdf")
            ' Create a new message and attach the PDF report to it.
            Dim Mail As New MailMessage()
            Mail.Attachments.Add(Att)
            ' Specify sender and recipient options for the e-mail message.
            Mail.From = New MailAddress("totyota@gmail.com", "Someone")
            Mail.To.Add(New MailAddress("totyota@gmail.com", "Someone"))
            ' Specify other e-mail options.
            Mail.Subject = "Próba"
            Mail.Body = "This is a test e-mail message sent by an application."
            ' Send the e-mail message via the specified SMTP server.
            Dim Smtp = New SmtpClient("smtp.gmail.com")
            Smtp.Send(Mail)
            ' Close the memory stream.
            Mem.Close()
            Mem.Flush()
        Catch ex As Exception
            'MessageBox.Show(Me, "Error sending a report.\n" + ex.ToString())
        End Try
    End Sub
End Class
Partial Public Class XtraReport1
    Inherits DevExpress.XtraReports.UI.XtraReport
    Public Sub New()
        'InitializeComponent()
    End Sub
End Class

