Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# Sending email using eircom.net

Options
  • 14-09-2006 9:31am
    #1
    Registered Users Posts: 450 ✭✭


    Hi,
    I have been getting the following error when trying to send an email using c# and the eircom.net server. I have turned off any firewalls and tried using ssl but that hasnt helped.
    Error:
    Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

    Here is my code..

    SmtpClient client = new SmtpClient();
    client.Credentials = new NetworkCredential("xxx@eircom.net", "password");

    client.Host = "mail1.eircom.net";
    //client.EnableSsl = true;
    client.Port = 25;
    client.Send(email);

    Any suggestions would be great.
    Thanks
    Ian


Comments

  • Closed Accounts Posts: 2 outofcoolnames


    Set objEmail = CreateObject("CDO.Message")

    objEmail.From = "sample@eircom.net" '<<<<<<
    Enter Your.Name again here and
    objEmail.To = "destination@eircom.net" 'capitilize first letter of each name.
    objEmail.Subject = "test email"
    objEmail.Textbody = ""
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
    "mail1.eircom.net"
    objEmail.Configuration.Fields.Item _
    ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    objEmail.Configuration.Fields.Update
    objEmail.Send


  • Registered Users Posts: 2,426 ✭✭✭ressem


    Well the code is OK, assuming you're using a network connection/ ethernet modem to connect to the internet.
    Does the "from" value in the message match the user name?
    Usually there is a restriction to prevent spamming.

    Using SSL won't help in debugging.
    I'd suggest running Ethereal/Wireshark www.wireshark.org on your computer if possible to examine the SMTP transaction to find out exactly where the problem occurs.

    A typical transaction will go like
    220 mailserver.eircom.net ready
    EHLO myhostname
    250-mailserver.eircom.net Hello [yourmachine]
    250-HELP
    250-ETRN
    250-DSN
    250-AUTH LOGIN
    250 AUTH=LOGIN
    AUTH login abcdefg
    334 fakehashwxfxr3
    fakepasswordhash43rf4x
    235 LOGIN authentication successful
    MAIL FROM:<me@eircom.net
    250 OK - mail from <me@eircom.net>
    RCPT TO:<destination@example.com>
    250 OK - Recipient <destination@example.com>
    DATA
    354 Send data. End with CRLF.CRLF
    mime-version: 1.0
    from: me@eircom.net
    to: destination@example.com
    date: 20 Sep 2006 13:31:11 +0100
    subject: Test mail
    content-type: text/plain; charset=us-ascii
    content-transfer-encoding: quoted-printable
    Mail body
    .

    250 OK

    Where the numbers preceding lines indicate that the line was sent by the server, and it's success/fail state.
    Stuff in italics was sent by the .net smtp client


Advertisement