CreateUserWizard - Cant send email (Google Apps)

RobertNZana
RobertNZana used Ask the Experts™
on
My hosting account is with GoDaddy BUT I am using Google Apps for my emails.

My ASP.NET website is using a CreateUserWizard.  But when it tries to send an email out it fails.  

My web.config smtp settings are as follows...
            <smtp from="xxx@xxxxx.com">
                <network host="smtp.gmail.com" userName="xxxxx@xxxx.com" password="xxxx" port="587" />
            </smtp>

My code is below...

Error is:  Parser Error Message: Insufficient permissions for setting the configuration property 'port'.
Protected Sub CreateUserWizard1_SendingMail(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MailMessageEventArgs) Handles CreateUserWizard1.SendingMail
        Dim smtpClient As New System.Net.Mail.SmtpClient
        smtpClient.EnableSsl = True
 
        Dim mm As New System.Net.Mail.MailMessage
        mm = e.Message
        smtpClient.Send(mm)
 
        e.Cancel = True
    End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
did you configure your gmail for IMAP enable from setting ?
http://dotnetstep.blogspot.com/2009/04/gmail-smtp-setting-to-send-email-from.html
Top Expert 2013
Commented:
The error is because GoDaddy does not allow you to set "port" attribute.i.e. you do not have full trust...
May be you might want to check with GoDaddy support ....

Author

Commented:
Yes but I still get...

System.Configuration.ConfigurationErrorsException: Insufficient permissions for setting the configuration property 'port'.



Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Author

Commented:
So, there is NO ONE OUT THERE sending emails thru their ASP.NET website (thru smtp.gmail.com) using GoDaddy?  Anyone?  Thanks for the info thus far...

Author

Commented:
For GoDaddy I believe this works....

              <smtp>
                <network host="relay-hosting.secureserver.net" port="25" defaultCredentials="true"/>
              </smtp>

I didn't use gmail servers to send...
Top Expert 2013
Commented:
Commented:
Good example below... Don't forget: emailClient.EnableSsl = true;


http://blog.dagoosh.com/post/2009/03/17/google-apps-gmail-send-email-asp.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial