Mailingliste udfra function
Hejsa!Jeg har en funktion hvor man kan skrive mailadresser ind i et tekstfelt, således man kan skrive flere mails i samme felt. Og har derfor en funktion som laver disse mails om til klikbare links.
Disse e-mailadresser vil jeg dog gerne nu have til at være i en mailingliste, men jeg aner bare ikke hvordan jeg skal gøre????
Jeg har smidt mine 2 scripts forneden: funktionen som omskriver e-mails til hyperlinks samt en simpel mailinglist!
<%
Function LinkString(strInput)
dim arrPattern, arrReplaceString, Rx, intIndex
arrPattern = Array("([\w\._-]+@[\w\._-]+\.[A-Za-z]{2,4}\S*)", _
"(http|https|ftp)(:\/\/[\w\._-]+\.[\w\._-]+\S*)", _
"(^|[^\/])(www[^\.\s]?\.[\w\._-]+\.[A-Za-z]{2,4}\S*)")
arrReplaceString = Array(" <a href='mailto:$1'>$1</a> ", _
" <a href='$1$2' target='_blank'>$1$2</a> ", _
" <a href='http://$2' target='_blank'>$2</a> ")
Set Rx = New RegExp
Rx.Global = True
Rx.IgnoreCase = True
For intIndex = 0 To UBound(arrPattern)
Rx.Pattern = arrPattern(intIndex)
strInput = Rx.Replace(strInput, arrReplaceString(intIndex))
Next
Set Rx = Nothing
LinkString = strInput
End Function
%>
<%
on error resume next
Do While Not mailinglisten.EOF
strEmail = request.form("emaile")
strNavn = request.form("navn")
soverskrift = request.form("overskrift")
standardtext = request.form("tekst")
Dim ThisURL
ThisURL = "http://" & Request.ServerVariables("SERVER_NAME") & _
Request.ServerVariables("PATH_INFO")
ThisURL = Replace(ThisURL, "admin/ekstras/mailinglist/sendmails.asp", "index.asp")
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "localhost"
JMail.Sender = request.form("sender")
JMail.SenderName = request.form("sendernavn")
JMail.ContentType = "text/plain"
JMail.Subject = request.form("subject")
JMail.AddRecipient strEmail
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Body = JMail.Body & "Hallo " & strNavn & VbCrLf & VbCrLf
JMail.Body = JMail.Body & soverskrift & VbCrLf
JMail.Body = JMail.Body & "--------------------------------------------------------" & VbCrLf & VbCrLf
JMail.Body = JMail.Body & standardtext & VbCrLf & VbCrLf
JMail.Body = JMail.Body & "Visit us online at: " & ThisURL & VbCrLf & VbCrLf
JMail.Body = JMail.Body & "--------------------------------------------------------" & VbCrLf
JMail.Execute
Set JMail = Nothing
mailinglisten.MoveNext
Loop
response.redirect("mailsent.asp")
%>
