Solved

send email C# smtpclient using ibm lotus

Posted on 2011-02-23
16
2,407 Views
Last Modified: 2013-12-18
I have gone through all the answers ... this is my situation

1. i need C# code to send email using ibm lotus account ( have username and password)
2. the server from which our app sends out emails is authorized
3. no firewall stopping
4. IBM lotus client is not installed on the server. so cannot use interop.domino.dll
5. the SMTP service is exposed. i have ip address and port. cant telnet to it and test it becasue server does not have telnet and they will not allow us enabling it

6. When i run the code below i get connection actively refused exception.

Is there any working code sample .. or am i missing something here .. any trouble shooting tips will be appreciated.


try
            {
                MailMessage message = new MailMessage();
                message.From = new MailAddress(from.Text);

                message.To.Add(new MailAddress(to.Text));
                //message.To.Add(new MailAddress("recipient2@foo.bar.com"));
                //message.To.Add(new MailAddress("recipient3@foo.bar.com"));

                //message.CC.Add(new MailAddress("carboncopy@foo.bar.com"));
                message.Subject = "Test email from cogniti";
                message.Body = "Test email from Cogniti";

                SmtpClient client = new SmtpClient();
               
                client.Port = Convert.ToInt32(port.Text);
                client.Host = smtp.Text;
                client.Credentials = new System.Net.NetworkCredential(username.Text, passwordBox1.Password);
                //client.UseDefaultCredentials = true;

                if (ssl.Text.Equals("1"))
                    client.EnableSsl = true;
                else
                    if (ssl.Text.Equals("2"))
                        client.EnableSsl = false;
                    else
                        client.EnableSsl = false;
                       

                client.UseDefaultCredentials = false;
                client.Send(message);

                MessageBox.Show("Message Sent to: " + to.Text);
            }
            catch (Exception e3)
            {
                MessageBox.Show(e3.Message);
                MessageBox.Show(e3.InnerException.ToString());
                MessageBox.Show(e3.Source);
                MessageBox.Show(e3.StackTrace);
            }
0
Comment
Question by:kedarkarthik
  • 9
  • 5
  • 2
16 Comments
 
LVL 22

Expert Comment

by:mbonaci
ID: 34968054
0
 

Author Comment

by:kedarkarthik
ID: 34968185
Yes I have seen them. Lotus notes client is not installed in the server machine. So i do not have access to the Domino objects. IT has to be done through exposed SMTP service.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34968866
Have you checked that the SMTP is actually running on Domino?
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 22

Expert Comment

by:mbonaci
ID: 34968887
What credentials are you using to authenticate?
Web username/password from Domino Directory?

See here for more details on Domino SMTP and authentication:
    http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.help.domino.admin.doc/DOC/H_CHANGING_THE_DEFAULT_SMTP_PORT_STEPS.html

Highest level link: Customizing Domino SMTP mail routing:
    http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.help.domino.admin.doc/DOC/H_CUSTOMIZING_SMTP_ROUTING_OVER.html
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34968899
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 34968916
You have the server's IP-address. Try to open port 25 using telnet:

      telnet IPaddress 25

And see what happens.

Here's what to test next:
http://thedaneshproject.com/posts/send-mail-through-smtp-using-telnet/
0
 

Author Comment

by:kedarkarthik
ID: 34971086
@mbonaci:
Yes it is running. Client takes care of this. They provided us the ip address , port of the SMTP service.
And also an account with username and password.

@sjef_bosman:
Do not have telnet on the server (this server is our product deployment server which has to send emails). I dont think they will allow us to enable telenet on the server. Is there any other way to check?

Client has already configured to expose its SMTP service ( we cant do that)

thank you for your replies. any other thought?
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34971205
Have you tried to set
    UseDefaultCredentials = false
before you assign the client.Credentials.

It seems that if you set UseDefaultCredentials after the client.Credentials, it will not send the AUTH command.


You don't need telnet on the server to run telnet command from a client.
That's just the way to check whether the port 25 is actually opened (like ping with port).
If the port is opened you should be able to connect to it using telnet.

When you say
    > Client has already configured to expose its SMTP service ( we cant do that)

what do you mean by "we can do that".
0
 

Author Comment

by:kedarkarthik
ID: 34971613
@mbonaci:

by > Client has already configured to expose its SMTP service ( we cant do that)... i mean we dont have control over it. We told us out requirements and they came back to us saying ... IBM Domino server has the SMTP service and port set. we can use xxx.xxx.xxxx.xxx ip post 25, username = x and password=y to send emails using the account.

tried UseDefaultCredentials and also providing credentials .. but always get exception something like connection was actively refused

0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 75 total points
ID: 34971799
Telnet on the server?? What do you need it for? What I suggested you to do is to test whether you can make an SMTP connection from a client PC to the Domino server through port 25, the SMTP port.  Hence the command, from the client PC:

      telnet 123.123.123.123 25
0
 
LVL 22

Assisted Solution

by:mbonaci
mbonaci earned 175 total points
ID: 34977806
0
 
LVL 22

Accepted Solution

by:
mbonaci earned 175 total points
ID: 34977830
Can you telnet the port 25?
This all smells like some kind of firewall/anti-virus blocking the incoming connection requests.
0
 

Author Comment

by:kedarkarthik
ID: 34980284
@sjef_bosman:
@ mbonaci:

I will be able to access client machine today and will do all the tests and update you asap ... they are in completely different time zone ...

@ mbonaci:  both SMTP service and our server are on same network ... and will  try out the link too ... i guess u r suggesting firewall/antivirus issue on our server .. and not the server on which SMTP service is hosted .. because our server is authorized to send requests ...

will keep you all updated. Thank you for ur replies.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 34980702
I'm suggesting to check firewall/AV on both servers in case you cannot telnet it on port 25.
0
 

Author Comment

by:kedarkarthik
ID: 34999813
tried telnet using putty. request didnt go through. Got a message saying all connections are actively refused. The it admin team is working on it.

thanks
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 35005062
You don't need putty, when you need telnet simply type in Windows command prompt on your local machine:
    telnet port_number

That command simply checks whether the port is accessible (it's used like ping with port).
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IT Desktop Support 11 90
Winform Module - What is the ASP.Net equiv 2 28
abstract class C# 1 31
Exchange Server alternative with the ability to fetch a pop account 4 37
Resolve DNS query failed errors for Exchange
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…

808 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