SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error on sending Email, Please Help!!! :(

    Hi All,
    from past few weeks i'm unable to overcome from this error in ASP.Net when sending email(I am a beginner in .NET). Would be great if i could get a solution here. Thanks.
    Error Page-(Internet Explorer)
    Server Error in '/Site' Application.
    --------------------------------------------------------------------------------

    An attempt was made to access a socket in a way forbidden by its access permissions 72.14.225.72: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: An attempt was made to access a socket in a way forbidden by its access permissions 72.14.225.72:25

    Source Error:


    Line 25:
    Line 26: SmtpClient mySmtpClient = new SmtpClient();
    Line 27: mySmtpClient.Send(myMessage);
    Line 28: }
    Line 29: }


    Source File: c:\BegASPNET\Site\Demos\Email.aspx.cs Line: 27
    Stack Trace:
    (Full of Codes, not needed i guess, ??)
    _________________________________________________________
    some part of "aspx.cs" page:
    protected void Page_Load(object sender, EventArgs e)
    {
    MailMessage myMessage = new MailMessage();
    myMessage.Subject = "Test Message";
    myMessage.Body = "Hello world, from planet wrox";

    myMessage.From = new MailAddress("sender@gmail.com", "John");
    myMessage.To.Add(new MailAddress("receiver@gmail.com", "Smith"));

    SmtpClient mySmtpClient = new SmtpClient();
    mySmtpClient.Send(myMessage);
    }
    ______________________________________________________
    web.config page:
    <system.net>
    <mailSettings>
    <smtp deliveryMethod="Network" from="John &lt;sender@gmail.com&gt;">
    <network host="smtp.google.com" userName="sender" password="password"/>
    </smtp>
    </mailSettings>
    </system.net>
    </configuration>
    ___________________________________________________
    Please help me in my quest to learn .NET, Thanks in advance.
    Regards,
    mikestar20

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,877
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)
    Well, if you are trying to use gmail servers to send email, it is not going to be that simple. You need to use SSL ports instead of standard ports and you need to setup your username and password in your config file as you did.

  3. #3
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do i use SSL port instead of standard port??
    and i already set my outlook express settings using this link-
    Outlook Express - Gmail Help
    http://mail.google.com/support/bin/a...y?answer=78892

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Add a port setting to your configuration to get the right port. Might be a SSL switch as well . . .

  5. #5
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Add a port setting to your configuration to get the right port. Might be a SSL switch as well . . .
    I added port to my configuration-
    <network host="smtp.google.com" port="465" userName="sender" password="password"/>
    but still not working.

    Quote Originally Posted by NightStalker-DNS View Post
    Well, if you are trying to use gmail servers to send email, it is not going to be that simple. You need to use SSL ports instead of standard ports and you need to setup your username and password in your config file as you did.
    I changed my SSL settings, and still not working.
    Attached Images Attached Images

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,629
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I think you need to turn on SSL in your app, not in outlook.

  7. #7
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how to turn SSL in app?? i'm new to .NET please help. If configuring mail settings for gmail is difficult then i can change to yahoo as well.
    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •