Menu

#1 Problem connecting to SMTP server

open
nobody
None
5
2015-04-02
2005-09-26
Anonymous
No

Hi

I have been evaluating DotNetOpenMail for use on a web
site.

It has been running nicely on one developer's computer.
However when running the site on my own machine I get
the following error message when calling Send():

[SocketException (0x2745): An established connection
was aborted by the software in your host machine]
System.Net.Sockets.Socket.Connect(EndPoint
remoteEP) +310
System.Net.Sockets.TcpClient.Connect(IPEndPoint
remoteEP) +24
DotNetOpenMail.SmtpProxy.Open() +54

[MailException: Could not connect to 127.0.0.1:25:25]
DotNetOpenMail.SmtpProxy.Open() +202
DotNetOpenMail.SmtpServer.Send
(ISendableMessage emailMessage,
EmailAddressCollection rcpttocollection, EmailAddress
mailfrom) +121
DotNetOpenMail.EmailMessage.Send(SmtpServer
smtpserver) +88

The code that I am using to send the message is as
follows:

EmailMessage objMessage;
SmtpServer objServer;

        objMessage = new

EmailMessage();

objMessage.FromAddress = new

EmailAddress("me@myaddress.com");

objMessage.AddToAddress

("me@myaddress.com");
objMessage.Subject
= "test";
objMessage.TextPart
= new TextAttachment("test");
objMessage.HtmlPart
= new HtmlAttachment("<p><b>test</b></p>");
objServer = new
SmtpServer("localhost");
objMessage.Send
(objServer);

The web sites are running locally on our machines and
we have our local SMTP Virtual Servers set up
identically. Can you shed any light on this?

Also the error message seems to repeat the port
number "Could not connect to 127.0.0.1:25:25".

Thanks

Daniel daniel@jpigroup.com

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Yes, I am facing a similar problem. It works fine if the mail
    sender and mail recipient are within the same domain.

    If the sender and recipient are in different domains "abc.com"
    and "xyz.com" then I get a similar error and i have also
    noticed that port 25 repeating twice in the error message. I
    understand that this is because relay has been disabled.

    To overcome this I created a new email account and use the
    account credentials for sending the mails and it works.

    EmailMessage MailMessage = new EmailMessage();

    /***** (all the From, to , attach code comes here) */

    DotNetOpenMail.SmtpServer DNsmtpServer = new
    DotNetOpenMail.SmtpServer(MailServer);

    DNsmtpServer.SmtpAuthToken = new
    DotNetOpenMail.SmtpAuth.SmtpAuthToken (UserName,
    Password);
    MailMessage.Send(DNsmtpServer );

    username could be "abc@abc.com" or just "abc". Though in
    my case providing just "abc" as username works fine I should
    admit that I havent got a grip of it yet.

    Now, I dont want to use the user credentials to send mails.
    Can someone throw more light on how this can be achieved?

     
  • Mike Bridge

    Mike Bridge - 2005-12-17

    Logged In: YES
    user_id=216685

    Hi-

    Sorry, I wasn't monitoring the Support Request area. Did
    you manage to fix this problem? The "Could not connect
    to..." error uses the System.Net.IPEndPoint.ToString() call
    to return, so I suspect that method is just a little wonky.
    As for the errors you're getting, it looks like the local
    server is rejecting the email for some reason. Could it be
    something like a spam filter or relaying issue?

    Again, sorry for the lateness of this response.

     
  • Nobody/Anonymous

    Logged In: NO

    I had a similar problem with another SMTP client that was
    caused by Mcaffee virus scanner.

    There is a rule, enabled by default, to prevent mass mailing
    worms from sending mail. If you open the virus scan console
    and look at the properties of the Access Protection task you
    will see the mass mailing rule. Edit this rule and add the
    name of your executable and it will then be allowed to send
    mail.

     
  • Mike Bridge

    Mike Bridge - 2006-05-09

    Logged In: YES
    user_id=216685

    That's a good idea too. Probably the top things to check
    when there's a local socket exception are:

    1) the SMTP server is running (you never know)
    2) the SMTP server is configured to accept local mail
    3) the SMTP server allows mail from you and your domain
    4) the SMTP server isn't throttling you based on volume
    5) the virus checker isn't rejecting it
    6) the spam filter isn't rejecting it
    7) there aren't any weird firewall rules

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.