Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Mailer script

Author  Topic 

Mlucas1
Starting Member

5 Posts

Posted - 2006-08-10 : 14:14:01
OK I am pretty new to this stuff. I hired programmers who left me in the lurch so I am trying to figure things out on my own I am having some real problems with the mailer scripts

I have inserted some code I got one script working but having probs with this one. Any help appreciated!

Also to note is "EMail an alias from User table because there is only an "email" column not EMail...


<%
cn = Session("cnn")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = cn

If Request.Form("btOk.x") > "0" then
sFEmail = Request.Form("EMail")
FromName = Request.Form("sYName")
sYEmail = Request.Form("sYEmail")
sIdTalent= Request.Form("sIdTalent")
Message = Request.Form("sMessage")


If Len(sFEmail) > 3 and InStr(1, sFEmail, "@") > 1 then
If Len(sYEmail) > 3 and InStr(1, sYEmail, "@") > 1 then

sQuery = "Select EMail From Table Where UserId = " &sIdTalent
rs.Source = sQuery
rs.Open
If not rs.EOF then

' THIS SENDS AN EMAIL TO SOMEONE TELLING THEM ABOUT THE NEW REGISTRATION
REM Message body
TextHeader = "This message is For :" & Chr(13) & Chr(10)
TextEnd = Chr(13) & Chr(10) & Chr(13) & Chr(10) & "Thank You"
FromName = "sYName" & Chr(13) & Chr(10)
Message = "sMessage" & VbCrLf & "http://" & Chr(13) & Chr(10) & Comments & Chr(13) & Chr(10)


Dim Mailer
Dim sMessage
Dim FromName
Dim sFEmail
Dim sYEmail

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.RemoteHost = "smtp.server.cot"
Mailer.FromName = "FromName"
Mailer.FromAddress = sYEmail
Mailer.AddRecipient sFEmail, Request.Form("email")
Mailer.BodyText = TextHeader & vbCrLf & Chr(13) & Chr(10) & Message & TextEnd
Mailer.Subject = "anything"


Mailer.SendMail
if Mailer.SendMail then

Response.Write "Ok ! Your message send to !..."

else

Response.Write "Mail send failure. Error was " & Mailer.Response

end if
%>

<h3><font color="green">Ok ! Your Message is sent to <%=FirstName%> (of Talent would be nice!!!!)
!</font></h3>

<% else %>

<font color=""red"">Error send message ! EMail address not valid !</font>
<%
End if

rs.Close

Else

If Request.QueryString("Id") > "0" then
sIdTalent = Request.QueryString("Id")
Else

If Session("iUserId") > 0 then
sUserId = CStr(Session("iUserId"))
End If

sQuery = "Select * From Table Where UserId = " &sUserId
rs.Source = sQuery
rs.Open

If rs.EOF then
sYName = ""
sYEmail = ""
Else
sYName = rs.Fields("FirstName").value&" "&rs.Fields("MiddleName").value&" "&rs.Fields("LastName").value
sYEmail = rs.Fields("email").value
sFEmail = rs.fields("EMail").Value
End If

rs.Close

End If
End If
End If
End If

%>
   

- Advertisement -