Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2010-08-13
3
Medium Priority
?
1,416 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
[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
3 Comments
 
LVL 8

Expert Comment

by:Yiogi
ID: 33428676
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 2000 total points
ID: 33437125

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

722 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