Link to home
Start Free TrialLog in
Avatar of pigmentarts
pigmentartsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

authentication with email please help

Could I have some help please? I am using asp.net to send email it have work will my other hosing, but my new hosing company requires authentication how do I send my user name and password now?

Thanks in advance my code below

 Dim mail As New MailMessage
                    mail.From = "sales@partygramms.co.uk"
                             mail.To = "gemma_glyn@yahoo.co.uk"
                    mail.Subject = "Request form kissagramm website"
                    mail.Body = "Client has submitted the following details for review"    
                    mail.BodyFormat = MailFormat.Html
                           SmtpMail.SmtpServer = "24.105.183.218"
                              SmtpMail.Send(mail)
Avatar of tusharashah
tusharashah

You can add fields to pass your Username/password:

        ' User account and password to authenticate to the server defined
        mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "YourUserName")
        mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "YourPassword")

Additionally check out following fields that you can utilize if you want:
       ' Mail Server Port Number (Default 25 - which is SMTP 25/TCP)
        mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "25")

        ' There are two levels of Send Usage
        ' cdoSendUsingPickup = 1 "Send message using the local SMTP service pickup directory."
        ' cdoSendUsingPort = 2 "Send the message using the network (SMTP over the network)."
        mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", "2")

        ' There are three levels of SMTP Authentication
        ' cdoAnonymous = 0 "Do not authenticate"
        ' cdoBasic = 1 "Use basic (clear-text) authentication."
        ' cdoNTLM = 2 "Use NTLM authentication"
        mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")

-tushar
Avatar of pigmentarts

ASKER

i just keep getting this error with the above code:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30037: Character is not valid.

Source Error:

 

Line 35:         mail2.Body = "Thank you for submitting your application with kissagramms.co.uk. We will contact you shortly about your party."
Line 36:         mail2.BodyFormat = MailFormat.Html
Line 37:             mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "2");
Line 38:             mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "mypassword");
Line 39:             mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "myusername");
 
ASKER CERTIFIED SOLUTION
Avatar of tusharashah
tusharashah

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank big help just a quick question, it now works does this mean everyone can not see my password and username in the code???

and when it sends it send the email to my bulk folder in yahoo why?
i will ask these questions in new topic hang on