Unable to send email

Discussion in 'ASP.NET 4.5 Beta [Closed]' started by ersehmi, Jun 18, 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 unable to send email from web application using sandbox asp.net 4.5 account

    I am using the folloign settings -

    SMTP Host localhost
    Port 25

    Please help!

    Regards,
    ErSehmi
     
  2. Hi Again,

    Moderator or somebody from discountasp.net might know the exact cause or the reason of it!

    Looking forward to hear from discountasp.net team!

    Regards,

    ErSehmi
     
  3. Do anybody know can we send an email from web application using our asp.net 4.5 sandbox account? Anybody got success in it! Please confirm!

    Regards,
    ErSehmi
     
  4. No

    No Single Reply from discountasp.net team member. Is everybody went to the Summer vacation?
     
  5. Free Sandbox features:
    Windows Server 2008 R2 Platform
    .NET Framework 4.5 beta
    100 MB disk space
    50 MB SQL Server 2008 R2 disk space
    FTP
    Uses DiscountASP.NET subdomain
    End Date: TBD
    http://labs.discountasp.net/netfx45/

    There is no SMTP service for sandbox program provided by DASP. You can use your own SMTP server.
     
  6. Hi Jayc,

    I am using my gmail's smtp server with my username and password, and it requires SSL at client.

    Which I think discountasp.net is not providing.

    So, I am getting the following expcetion in the code -

    System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at ASP.mailtest_aspx.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
     
  7. It's not that. You don't need SSL as a client. Google wants you to connect to their SMTP over SSL

    so what you gotta do, make sure you connect over SSL.

    smtp.EnableSsl = true;
     
  8. Hi Jayc,

    You have suggested to use port 465, I really doubt that port 465 is blocked at discountasp.net server. Since the code is still throwing an exception.

    Operation Timed Out while sending an email

    System.Net.Mail.SmtpException: The operation has timed out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at ASP.mailtest_aspx.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

    Please suggest some alternative to send an email!

    Regards,

    Ersehmi
     
  9. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    Ershemi,

    I think you may have misunderstood what JayC was saying. If you want to send an email using Google's SMTP server and SSL, you must connect on port 465. If you don't want to use SSL, you can try 25 or 587. It doesn't have anything to do with a port being blocked. These are just the port settings that Google specifies that you must connect on.
     
  10. Can anybody suggest why I am getting operation timed out using port 465 and enable ssl = true
     
  11. Can anybody please comment on this.

    I shall be very thankful to you!

    Regards,
    ErSehmi
     
  12. Sandbox server has .NEt framework installed on it. So yes, you can send mail with SMTP from there.

    Anyway, I just test this. Its working w/o timeout from Gmail server.

    using System.Net.Mail;
    using System.Net;


    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]" , "password");
    smtp.Credentials = Credentials;

    smtp.EnableSsl = true;
    smtp.Send(mail);
    Response.Write( "message sent!");
    }
     
  13. Hi Jayc,

    Your code is throwing the following exception. I am sure that sandbox account is configured not to send an email.

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

    <script language="C#" runat="server">
    protected void Page_Load(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]", "xxx");
    smtp.Credentials = Credentials;
    smtp.EnableSsl = true; smtp.Send(mail);
    Response.Write("message sent!");
    }
    </script>
    <html>
    <body>
    <form runat="server">
    <asp:Label id="lblMessage" runat="server"></asp:Label>
    </form>
    </body>
    </html>


    The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at.

    System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Send(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at ASP.mailtest_aspx.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


    Regards,

    ErSehmi
     
  14. None of the above code works at all on discountasp.net!
     
  15. mjp

    mjp

    Your question has been answered a couple of times. Sorry you can't get it to work, but there's nothing preventing anyone from sending mail from a Labs account.
     
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