Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sending email without using password in credentials vb.net

Posted on 2009-02-23
6
Medium Priority
?
942 Views
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("smtp.gmail.com", 587)
        mailMsg = New MailMessage("username@gmail.com", "receiver@hotmail.com", "Your enquiry has been confirmed", "Information was successfully sent to email")
         smtp.EnableSsl = True
        smtp.UseDefaultCredentials = False
        smtp.Credentials = New NetworkCredential("username@gmail.com", "mypassword")         
        smtp.Send(mailMsg)

Open in new window

0
Comment
Question by:lashler2
6 Comments
 
LVL 8

Assisted Solution

by:theplonk
theplonk earned 400 total points
ID: 23717661
You will have to change the authenication settings on the smtp service.
0
 
LVL 8

Expert Comment

by:theplonk
ID: 23717669
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".
0
 
LVL 15

Expert Comment

by:JackOfPH
ID: 23718007
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...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

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

Expert Comment

by:RahulParashar
ID: 23725419
and yes, you have to have your won exchange server for this.
0
 

Accepted Solution

by:
lashler2 earned 0 total points
ID: 23740841
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".
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

575 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