|
 |
asp_cdo thread: limited sending message on 2 email domains
Message #1 by "Thao Nguyen" <thuthao18@h...> on Mon, 22 Jan 2001 23:10:34 -0000
|
|
Hello everyone,
I've created a Knowlege Base page for my project. I would like to email
some article that I'm interested from the Knowledge Base to people such as
@private1.com and @private2.com. How can I restrict only sending email to
only 2 these private domains? Here is the code that I wrote but this
script can send to any domain. Can someone help me???
-----------------------
<%
Sub SendEmailMessage(psFrom, psTo, psSubject, psBody)
Dim objMail
Dim iTemp
Err.Clear
On Error Resume Next
Set objMail = Server.CreateObject("SMTPsvg.Mailer")
If Err.Number <> 0 Then
Response.Write("<BR><STRONG>Error:</STRONG>Could not create SMTPsvg.Mailer object<BR>")
Else
objMail.RemoteHost = gsMailHost
objMail.FromName = "" & psFrom
objMail.FromAddress = "" & psFrom
objMail.AddRecipient "" & psTo, "" & psTo
objMail.Subject = "" & psSubject
objMail.BodyText = "" & psBody
If Not objMail.SendMail Then
Response.Write "There is an error with sending email but your question
saved to database."
End If
End If
Set objMail = Nothing
On Error Goto 0
End Sub
Sub SendEmailMessageWithFile(psFrom, psTo, psSubject, psBody, psFile)
Dim objMail
Dim iTemp
Err.Clear
On Error Resume Next
Set objMail = Server.CreateObject("SMTPsvg.Mailer")
If Err.Number <> 0 Then
Response.Write("<BR><STRONG>Error:</STRONG>Could not create SMTPsvg.Mailer object<BR>")
Else
objMail.RemoteHost = gsMailHost
objMail.FromName = "" & psFrom
objMail.FromAddress = "" & psFrom
objMail.AddRecipient "" & psTo, "" & psTo
objMail.Subject = "" & psSubject
objMail.BodyText = "" & psBody
objMail.ClearAttachments
objMail.AddAttachment "" & psFile
If Err.Number <> 0 Then
Response.Write("<BR><STRONG>Error:</STRONG>Could not attach file (" & psFile & ") to the
SMTPsvg.Mailer object<BR>")
Else
End If
iTemp = objMail.SendMail
End If
Set objMail = Nothing
On Error Goto 0
End Sub
%>
Message #2 by "Sajid Husain" <sajid_pk@h...> on Tue, 23 Jan 2001 12:05:35
|
|
very straight forward..........before sending email check the email address
and if it belongs to domains u specified then carry on the process i.e.
sending the mail otherwise leave all the process and exit.
if i am wrong then do send me acknowledgment on sajid_pk@h...
sajid...............
smile........
>From: "Thao Nguyen" <thuthao18@h...>
>Reply-To: "ASP CDO" <asp_cdo@p...>
>To: "ASP CDO" <asp_cdo@p...>
>Subject: [asp_cdo] limited sending message on 2 email domains
>Date: Tue, 23 Jan 2001 10:40:29 -0800
>
>Hello everyone,
>
>I've created a Knowlege Base page for my project. I would like to email
>some article that I'm interested from the Knowledge Base to people such as
>@private1.com and @private2.com. How can I restrict only sending email to
>only 2 these private domains? Here is the code that I wrote but this
>script can send to any domain. Can someone help me???
>
>-----------------------
><%
>Sub SendEmailMessage(psFrom, psTo, psSubject, psBody)
> Dim objMail
> Dim iTemp
> Err.Clear
> On Error Resume Next
> Set objMail = Server.CreateObject("SMTPsvg.Mailer")
> If Err.Number <> 0 Then
> Response.Write("<BR><STRONG>Error:</STRONG>Could not create
>SMTPsvg.Mailer object<BR>")
> Else
> objMail.RemoteHost = gsMailHost
> objMail.FromName = "" & psFrom
> objMail.FromAddress = "" & psFrom
> objMail.AddRecipient "" & psTo, "" & psTo
> objMail.Subject = "" & psSubject
> objMail.BodyText = "" & psBody
> If Not objMail.SendMail Then
> Response.Write "There is an error with sending email but your question
>saved to database."
> End If
> End If
> Set objMail = Nothing
> On Error Goto 0
>End Sub
>
>Sub SendEmailMessageWithFile(psFrom, psTo, psSubject, psBody, psFile)
> Dim objMail
> Dim iTemp
> Err.Clear
> On Error Resume Next
> Set objMail = Server.CreateObject("SMTPsvg.Mailer")
> If Err.Number <> 0 Then
> Response.Write("<BR><STRONG>Error:</STRONG>Could not create
>SMTPsvg.Mailer object<BR>")
> Else
> objMail.RemoteHost = gsMailHost
> objMail.FromName = "" & psFrom
> objMail.FromAddress = "" & psFrom
> objMail.AddRecipient "" & psTo, "" & psTo
> objMail.Subject = "" & psSubject
> objMail.BodyText = "" & psBody
> objMail.ClearAttachments
> objMail.AddAttachment "" & psFile
> If Err.Number <> 0 Then
> Response.Write("<BR><STRONG>Error:</STRONG>Could not attach file ("
>& psFile & ") to the
>SMTPsvg.Mailer object<BR>")
> Else
> End If
> iTemp = objMail.SendMail
> End If
> Set objMail = Nothing
> On Error Goto 0
>End Sub
>%>
>
|
|
 |