הבעיה היא שהקוד פועל רק עבור נמען אחד ואני רוצה לאפשר למשתמש להוסיף נמענים ללא הגבלה (טוב נו, אפשר להגביל ל-10 למשל).
איך אני יכול לעשות את זה? אני מניח שדף ה-ASP יצטרך לפרק את המחרוזת של המייל לפי התו המפריד (חשבתי שפסיק יפריד בין מייל למייל).
הנה הקוד הנוכחי, אשמח לעזרתכם...
Using asp Syntax Highlighting
<% @ Codepage=65001 %>
<%
Set conn = Server.CreateObject("ADODB.Connection")
ConnStr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=PATH\cards.mdb"
conn.open ConnStr
function toSqlStirng(sStr)
sStr = replace(sStr,"'", "''")
toSqlStirng = "'" & sStr & "'"
end function
sender1 = toSqlStirng(Request("sender"))
sceneID1 = toSqlStirng(Request("sceneID"))
animations1 = toSqlStirng(Request.Form("animations"))
text1 = toSqlStirng(Request.Form("text"))
airbrush1 = toSqlStirng(Request.Form("airbrush"))
to1 = toSqlStirng(Request.Form("to"))
from1 = toSqlStirng(Request.Form("from"))
if sender1 <> "" then
sql = "insert into cardz (sender1,sceneID1,m1,m2,text1,airbrush1,animations1,sdate)VALUES" & _
"(" & sender1 & "," & sceneID1 & "," & to1 & "," & from1 & "," & text1 & "," & airbrush1 & "," & animations1 & ",'" & now() & "')"
'Response.Write sql
conn.execute(sql)
sql = "select max(id) from cardz"
set rs = conn.execute(sql)
if not rs.eof then
new_id = rs(0)
new_id = (new_id * 11)-7
end if
end if
Function CDONTS2(sFrom, sTo, sSubject, sBody, sBcc)
Dim MyCDONTSMail
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.BodyFormat = 0
MyCDONTSMail.MailFormat = 0
MyCDONTSMail.From = sFrom
MyCDONTSMail.To = sTo
MyCDONTSMail.Subject = sSubject
MyCDONTSMail.Body = sBody
if sBcc <> "" then MyCDONTSMail.bcc = sBcc
'If scc<>"" Then MyCDONTSMail.CC= sCC
'If sbcc<>"" Then MyCDONTSMail.bcc= sbcc
MyCDONTSMail.Send
set MyCDONTSMail = nothing
End Function
'/// set objMail = Server.CreateObject("CDO.Message")
if Request("test") = 9 then
'objMail.To = "test@test.co.il"
'objMail.From = "test@test.co.il"
sTo = "test@test.co.il"
sFrom = "test@test.co.il"
else
'objMail.To = Request.Form("to")
'objMail.From = Request.Form("from")
sTo = Request.Form("to")
sFrom = Request.Form("from")
end if
'/objMail.Subject = "שנה טובה"
sSubject = "שנה טובה"
'set b = objMail.bodypart
'b.charset = "unicode-1-1-utf-8"
tBody = "<html><head><title></title><meta http-equiv='content-type' content='text/html; charset=utf-8'></head>" & _
"<body>
//כאן תוכן הברכה
</body></html>"
sBody = tBody
call CDONTS2(sFrom, sTo, sSubject, sBody, sBcc)
'objMail.HTMLBody=tBody
'objMail.Send
'objMail = null
'//if objMail.SendMail then
'//Response.Write "debug="&Request.Form("text")
'// else
'//Response.Write "debug=Failure"
'//end if
'if Request("test") = 9 then
Response.Write tBody
Conn.close
Set Conn = Nothing
%>
<%
Set conn = Server.CreateObject("ADODB.Connection")
ConnStr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=PATH\cards.mdb"
conn.open ConnStr
function toSqlStirng(sStr)
sStr = replace(sStr,"'", "''")
toSqlStirng = "'" & sStr & "'"
end function
sender1 = toSqlStirng(Request("sender"))
sceneID1 = toSqlStirng(Request("sceneID"))
animations1 = toSqlStirng(Request.Form("animations"))
text1 = toSqlStirng(Request.Form("text"))
airbrush1 = toSqlStirng(Request.Form("airbrush"))
to1 = toSqlStirng(Request.Form("to"))
from1 = toSqlStirng(Request.Form("from"))
if sender1 <> "" then
sql = "insert into cardz (sender1,sceneID1,m1,m2,text1,airbrush1,animations1,sdate)VALUES" & _
"(" & sender1 & "," & sceneID1 & "," & to1 & "," & from1 & "," & text1 & "," & airbrush1 & "," & animations1 & ",'" & now() & "')"
'Response.Write sql
conn.execute(sql)
sql = "select max(id) from cardz"
set rs = conn.execute(sql)
if not rs.eof then
new_id = rs(0)
new_id = (new_id * 11)-7
end if
end if
Function CDONTS2(sFrom, sTo, sSubject, sBody, sBcc)
Dim MyCDONTSMail
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.BodyFormat = 0
MyCDONTSMail.MailFormat = 0
MyCDONTSMail.From = sFrom
MyCDONTSMail.To = sTo
MyCDONTSMail.Subject = sSubject
MyCDONTSMail.Body = sBody
if sBcc <> "" then MyCDONTSMail.bcc = sBcc
'If scc<>"" Then MyCDONTSMail.CC= sCC
'If sbcc<>"" Then MyCDONTSMail.bcc= sbcc
MyCDONTSMail.Send
set MyCDONTSMail = nothing
End Function
'/// set objMail = Server.CreateObject("CDO.Message")
if Request("test") = 9 then
'objMail.To = "test@test.co.il"
'objMail.From = "test@test.co.il"
sTo = "test@test.co.il"
sFrom = "test@test.co.il"
else
'objMail.To = Request.Form("to")
'objMail.From = Request.Form("from")
sTo = Request.Form("to")
sFrom = Request.Form("from")
end if
'/objMail.Subject = "שנה טובה"
sSubject = "שנה טובה"
'set b = objMail.bodypart
'b.charset = "unicode-1-1-utf-8"
tBody = "<html><head><title></title><meta http-equiv='content-type' content='text/html; charset=utf-8'></head>" & _
"<body>
//כאן תוכן הברכה
</body></html>"
sBody = tBody
call CDONTS2(sFrom, sTo, sSubject, sBody, sBcc)
'objMail.HTMLBody=tBody
'objMail.Send
'objMail = null
'//if objMail.SendMail then
'//Response.Write "debug="&Request.Form("text")
'// else
'//Response.Write "debug=Failure"
'//end if
'if Request("test") = 9 then
Response.Write tBody
Conn.close
Set Conn = Nothing
%>
Parsed in 0.018 seconds, using GeSHi 1.0.8.4


חדשות