473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How can I authenticate when sending email?

I have had success using ASP to send out mail, however, how can I make it
send mail using an external SMTP server that requires authentication?

Thanks!
Jul 19 '05 #1
2 2112
Use CDO.Message + CDO.Configuration, which supports cdoSMTPAuthenticate.
http://www.aspfaq.com/2026
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"michaaal" <re******@verizon.net> wrote in message
news:#e**************@TK2MSFTNGP09.phx.gbl...
I have had success using ASP to send out mail, however, how can I make it
send mail using an external SMTP server that requires authentication?

Thanks!

Jul 19 '05 #2
'************************************************* *****
'*** Send the message Using CDOSYS Win2k & Win2003 ****
'************************************************* *****
' CDO mail object
myMailServer = sEmailServer

sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields.Item(sch & "sendusing") = 2
cdoConfig.Fields.Item(sch & "smtpserverport") = iEmailPort
cdoConfig.Fields.Item(sch & "smtpserver") = myMailServer
cdoConfig.fields.update

Set cdoMessage = Server.CreateObject("CDO.Message")
Set cdoMessage.Configuration = cdoConfig
cdoMessage.From = sEmailAddFrom
cdoMessage.To = sConAdHocAddress
cdoMessage.BCC = sConEmailMonitor
cdoMessage.Subject = MakeValid(sSubject)
cdoMessage.TextBody = MakeValid(sBodyText)
If Trim(sUploadFile) <> "" Then
cdoMessage.AddAttachment "file://" & sTempPath & sUploadFile
ClearFilespec sTempPath & sUploadFile
End If

cdoMessage.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenti
cate").value = 1 ' use clear text authenticate

cdoMessage.item("http://schemas.microsoft.com/cdo/configuration/sendpassword
").value ="mypassword"

cdoMessage.item("http://schemas.microsoft.com/cdo/configuration/sendusername
").value ="yourusername"
cdoMessage.Fields.Item("urn:schemas:mailheader:Key words") = "website"
cdoMessage.Fields.Item("urn:schemas:mailheader:X-Priority") = 1
cdoMessage.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") =
"High"
cdoMessage.Fields.Item("urn:schemas:mailheader:X-Message-Flag") = "Do
not Forward"
cdoMessage.Fields.Item("urn:schemas:mailheader:Sen sitivity") =
"Company-Confidential"
cdoMessage.Fields.Item("urn:schemas:mailheader:Imp ortance") = "High"
cdoMessage.Fields.Update
cdoMessage.Send
Set cdoMessage = Nothing
Set cdoConfig = Nothing

"michaaal" <re******@verizon.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I have had success using ASP to send out mail, however, how can I make it
send mail using an external SMTP server that requires authentication?

Thanks!

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: thenetflyer | last post by:
<!-- The following sample should authorize the user to log on the site. This works once but after refreshing the browser, it does not prompt again for login until all browser (IE 6) windows are...
3
by: Glen Wolinsky | last post by:
We have written a service that runs in the background to deliver email to our users. The emails are generated from data in SQL that our application creates. This service sends out thousands of...
7
by: Sync Walantaji | last post by:
Hi, I would like to write a asp.net winform program to authenticate users on Active Directory. Can I do this with asp.net if the IIS server is not part of the Active directory domain? Is...
13
by: ALI-R | last post by:
I know how to authenticate to a webservice using either of these ways(Assuming that rService represents the webservice): 1) rService.Credentials = new...
5
by: nikou_70 | last post by:
when I turn off Anonymous in IIs I get this Error : HTTP 401.2 - Unauthorized: Logon failed due to server configuration This is usually caused by a server-side script not sending the proper...
1
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page,...
4
by: Jon | last post by:
I am modifying an app for a customer in ASP.Net 1.1. The app is running on a server outside their network, yet they want to authenticate users against their internal active directory set up (they...
1
by: Steven Cheng [MSFT] | last post by:
Hi Schmitz, Have you got any progress on this issue? Sincerely, Steven Cheng Microsoft MSDN Online Support Lead
3
by: kurtk | last post by:
I had a question about the use of the HTTP header 'WWW-Authenticate' in PHP scripts. For example, the script below sends the header 'WWW- Authenticate: Basic Realm="Secret Stash"', followed by the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.