How to mail the ranorex report

Class library usage, coding and language questions.
Posts: 16
Joined: Thu Jun 20, 2013 3:03 pm

How to mail the ranorex report

Post by tiara » Thu Jul 11, 2013 4:04 pm

I have read many posts of emailing the ranorex report... but nothing helped much to mail me the report.... This is my code.... Please tell me what I am missing...

Imports System.Net.Mail
Imports System.Windows.Forms
Imports Ranorex.Core
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Net.Mime
Imports System.Text
Imports Ranorex
Namespace TestSuit
Public Class MailLogger
Implements IReportLogger
Private Shared m_host As String = "defaulthost"
Private Shared m_port As Integer = 25
Private Sub SendMail(sender As Object, e As EventArgs)
Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient("")
mail.From = New MailAddress("[email protected]")
mail.[To].Add("[email protected]")
mail.Subject = "Ranorex Test Mail"
mail.Body = "mail with attachment of Ranorex Report"
Dim attachment As System.Net.Mail.Attachment
Dim filename As String = Ranorex.Core.Reporting.TestReport.ReportFilename
Dim Zipfile As String = filename.Replace("rxlog", "rxzlog")
If System.IO.File.Exists(Zipfile) Then
Dim MyReport As New System.Net.Mail.Attachment(Zipfile)
End If
attachment = New System.Net.Mail.Attachment("C:\Users\Administrator\Documents\Ranorex\RanorexStudio Projects\TestSuit\TestSuit\Reports\TestSuit_20130625_095408.rxlog")
SmtpServer.Port = 25
SmtpServer.Credentials = New System.Net.NetworkCredential("username", "password")
Dim client As New System.Net.Mail.SmtpClient([email protected])
Dim basicCredential As New System.Net.NetworkCredential("mailto:[email protected]","22nnnnnn")
SmtpServer.EnableSsl = True
MessageBox.Show("mail Send")
Catch ex As Exception
End Try
End Sub

I have added SendMail() in the program.vb too

Please help me where I am going wrong!!!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: How to mail the ranorex report

Post by Support Team » Fri Jul 12, 2013 2:31 pm


It seems that you used your email address instead for your smtp client.
Please try out the following code:
Dim client As New System.Net.Mail.SmtpClient("")
Do you get any error messages during build?
You would need to implement all methods of the IReportLogger interface.
Please use the 'language' tag to post code. It's hard to read it otherwise.
Thank you.

Markus (T)