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
Solved

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

Posted on 2010-08-13
3
1,396 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
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 500 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Pop culture is prime bait for hackers seeking to infect user’s computers and mobile devices with malicious malware. Hackers know exactly what the latest trends are online and know how to use them to their advantage.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

860 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