Sending email without using password in credentials

Posted on 2009-02-23
Last Modified: 2012-05-06
Hi everybody,

        The following code works perfectly as it sends information to the receiver's email address from the sender's(username) email address, but the problem i have is i must provide a password in the credentials in  order to send the email, if not i would get an error about authentication.
Is there any way i can send an email message from one email address to another one without providing the password and get no errors with authentication????

Dim smtp As SmtpClient

        Dim mailMsg As New MailMessage


        smtp = New SmtpClient("", 587)

        mailMsg = New MailMessage("", "", "Your enquiry has been confirmed", "Information was successfully sent to email")

         smtp.EnableSsl = True

        smtp.UseDefaultCredentials = False

        smtp.Credentials = New NetworkCredential("", "mypassword")         


Open in new window

Question by:lashler2
    LVL 8

    Assisted Solution

    You will have to change the authenication settings on the smtp service.
    LVL 8

    Expert Comment

    e.g. if you are running an smtp virtual server on windows server 2003.
    Open up iis goto the properties of the smtp virtual server. Goto Access tab. click the Authentication button. Tick "Anonymous access".
    LVL 15

    Expert Comment

    I don't think it is possible, unless you have your own IIS server, as stated by thePlonk.

    Your code is using GMAIL smtp server and I don't think you have an access on that...

    Expert Comment

    You can do so by making UseDefaultCredentials property "True" and not supplying credentials. so remove the line
    (smtp.Credentials = .......)

    Expert Comment

    and yes, you have to have your won exchange server for this.

    Accepted Solution

    ok thanks everyone for the  help....I figured what i wanted to do wouldn't work unless i had my own IIS server so i could change the authenication settings. In response to RahulParashar, I tried using the line UseDefaultCredentials property as "True" before, but i just got the error message "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required".

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    This video discusses moving either the default database or any database to a new volume.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now