Email Issue

Discussion in 'Email' started by ersehmi, Jul 14, 2012.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I am using the code to send an email from the following link

    http://support.discountasp.net/KB/a364/how-to-send-email-in-aspnet-20.aspx

    The code that I am using is exactly same with no changes except from and to email addresses.

    The page is hosted at: http://user1092.netfx45lab.discountasp.net/mail.aspx

    I am getting the following issue -

    Server Error in '/' Application.
    --------------------------------------------------------------------------
    No connection could be made because the target machine actively refused it 127.0.0.1:25
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25

    Source Error:


    Line 13: //send the message
    Line 14: SmtpClient smtp = new SmtpClient("localhost");
    Line 15: smtp.Send(mail);
    Line 16: lblMessage.Text = "Mail Sent";
    Line 17: }

    Source File: e:\web\user1092\htdocs\mail.aspx Line: 15



    Can anybody from discountasp.net team please help me to resolve this issue!

    Regards,
    ErSehmi
     
  2. I have changed to the code to the following. Now I am getting the operation timeout issue -

    The demo page is hosted at: http://user1092.netfx45lab.discountasp.net/mail.aspx


    <%@ Import Namespace="System.Net.Mail" %>
    <%@ Import Namespace="System.Net" %>

    <script language="C#" runat="server">

    protected void button1_Click(object sender, EventArgs e)
    {

    MailMessage mail = new MailMessage();


    mail.From = new MailAddress ("[email protected]");
    mail.To.Add( "[email protected]");


    mail.Subject = "Just a test courtesy of DASP";
    mail.Body = "Just a test courtesy of DASP";

    SmtpClient smtp = new SmtpClient( "smtp.gmail.com");

    NetworkCredential Credentials = new NetworkCredential("[email protected]" , "xxxxxx");
    smtp.Credentials = Credentials;
    smtp.Port = 465;
    smtp.EnableSsl = true;
    smtp.Send(mail);
    lblMessage.Text = "message sent!";
    }

    </script>
    <html>
    <body>
    <form runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
    <asp:Button id="button1" runat="server" Text="Send Mail!" OnClick = "button1_Click" />
    </form>
    </body>
    </html>


    Regards,

    ErSehmi
     
  3. Resolved: Email Issue

    The resolution is: Google has a security feature, when any of an non trusted application of website tries to access your account google will prevent it automatically, and you have to allow an application to use your google account on your behalf.


    Gmail will drop a following email to your account, if it detect some Suspicious sign

    Suspicious sign in prevented
    Inbox

    [email protected]
    Jun 22

    to me

    Someone recently tried to use an application to sign in to your Google Account, [email protected]. We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:
    Friday, June 22, 2012 2:08:05 PM GMT
    IP Address: 216.177.83.3 (discountasp.net)
    Location: United States

    If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately. Find out how at http://support.google.com/accounts?p=reset_pw
    If this was you, and you want to give this application access to your account, complete the troubleshooting steps listed at http://support.google.com/mail?p=client_login

    Sincerely,

    The Google Accounts Team
     
  4. Mods you may proceed to close this thread! Since it has been resolved now!
     
  5. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Hi Ersehmi,

    Thanks for posting the update. The thread does not need to be closed, since it can help others if they run into a similar issue.
     
  6. Thanks Tassleoff!
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page