Solved

Sending Email from VB.net using the same mailserver used for Lotus Notes

Posted on 2010-08-13
3
1,375 Views
Last Modified: 2013-11-30
I am receiving the below mentioned error while sending the mail from my VB.net application.
The mailserver used is the same one used by our lotus notes.
Transaction failed. The server response was: Relay rejected for policy reasons.
Try

       
            Dim msg As MailMessage
            Dim objSmtpClient As New System.Net.Mail.SmtpClient()

            msg = New MailMessage()

            msg.From = New System.Net.Mail.MailAddress(txtFromId.Text)
            msg.To.Add(New System.Net.Mail.MailAddress(txtToId.Text))
            msg.Subject = "Test Mail"
            msg.Body = txtBody.Text
            objSmtpClient.UseDefaultCredentials = True
            objSmtpClient.Credentials = New Net.NetworkCredential("xxxxxxxx", "xxxxxxxx")
            objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network
            objSmtpClient.Host = txtIP.Text.Trim()
            objSmtpClient.Port = 25
            objSmtpClient.Send(msg)

        Catch ex As Exception

        End Try
0
Comment
Question by:khan_maswood
3 Comments
 
LVL 8

Expert Comment

by:Yiogi
Comment Utility
Your code is ok, the problem is with your exchange server policy. It will not let you relay and send mail as someone else from another machine.

You can configure exchange to allow relay but it's a security hole and I strongly advice against it.

If you do choose to configure it please make sure you only allowed a specific ip from the machine you want to send the email to be able to do this and don't open it for everyone on the internet or you will find out your mail server is getting abused and used for sending spam from all over the world.
0
 
LVL 16

Accepted Solution

by:
kris_per earned 500 total points
Comment Utility

Lotus Notes uses its own protocol to submit the mails to the Lotus Domino server...If you want to use the same method, then you have to use Notes com objects in .net; check out this link => http://www.codeproject.com/KB/cs/LotusNotesWithCS.aspx

If you want to use System.Net.Mail.SmtpClient as above in your code...SMTP must have been enabled in Lotus Domino server (check with your admin). In this case I think you have to use the smtp server address in SmtpClient constructor like:
Dim objSmtpClient As New System.Net.Mail.SmtpClient("server address")
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Total in textboxes 9 35
Wpf develop 5 30
Hovering effect 9 28
What .NET website keeps me current? 9 28
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now