1245
צפיות
צפיות
6
תשובות
תשובות
[asp] בעיה עם טופס יצירת קשר…
אני מנסה ליצור טופס יצירת קשר אבל מסיבה לא ברורה הוא לא קורא לי את המידע מקובץ mailer.asp והוא כותב שהקובץ לא נמצא,
אשמח לדעת היכן הטעות שלי..
אשמח לציין שאין סיבה לערוך את הקובץ ASP כי הוא עובד דרך הפלאש, אני רק מנסה לבצע את השליחה דרך HTML.
הקובץ ASP, mailer.asp
העלתי את הקבצים בגלל ההגבלה של הכמות תווים
תודה מראש
6 תשובות
חסר מידע בשאלה שלך, אבל
בד"כ אם הקובץ לא נימצא אז יש שגיאה בנתיב הקובץ. תבדוק שהנתיב שכתבת אכן קיים.
הנתיב אכן נכון…
אין לי מושג למה זה קורה,
הנתיב אכן נכון, ואין כל שגיאה עם הכתיבה של שם הקובץ….
אין לי שמץ של מושג מדוע זה קורה,
אני אצרף את שני הקודים בשני הודעות מפני ההגבלה של התווים.
הקוד של הHTML הוא…
<html>
<head>
</head>
<body>
<form method="post" action="mailer.asp">
<table width="100%" height="1" border="0" cellpadding="6" cellspacing="0">
<tr>
<td width="90%" align="right">
<input type="text" name="FirstName">
</td>
<td width="10%" align="right">שם</td>
</tr>
<tr>
<td width="90%" align="right">
<input type="text" name="LastName">
</td>
<td width="10%" align="right">משפחה</td>
</tr>
<tr>
<td width="90%" align="right">
<input type="text" name="Phone">
</td>
<td width="10%" align="right">טלפון</td>
</tr>
<tr>
<td align="right"><input type="text" name="Country"></td>
<td align="right">ארץ</td>
</tr>
<tr>
<td align="right"><input type="text" name="Subject"></td>
<td align="right">נושא</td>
</tr>
<tr>
<td align="right"><textarea name="Email" cols="60" rows="8"></textarea></td>
<td align="right">דוא"ל</td>
</tr>
<tr>
<td align="right"><input type="submit" value="שלח"></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
הקוד של הPHP
<%
Dim objCDOMail 'The CDO object
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "kellogg.win.aplus.net"
.update
End With
' Create an instance of the NewMail object.
Set objMessage = Server.CreateObject("CDO.Message")
Set objMessage.Configuration = cdoConfig
' *********************************************************
' Creating the body text
Dim BodyString
BodyString = BodyString & "IP – " & Request.ServerVariables("REMOTE_ADDR") & " <BR>
BodyString = "<html><body> First Name – " & Request.Form("FirstName") & " <BR> "
BodyString = BodyString & "Last Name – " & Request.Form("LastName") & " <BR> "
BodyString = BodyString & "Phone – " & Request.Form("Phone") & " <BR> "
BodyString = BodyString & "Country – " & Request.Form("Country") & " <BR> "
BodyString = BodyString & "Email – " & Request.Form("Email") & " <BR> "
BodyString = BodyString & "Subject – " & Request.Form("Subject") & " <BR> "
BodyString = BodyString & "Nature Of Inquiry – " & Request.Form("NOfInq") & " <BR> "
BodyString = BodyString & "Add To List – " & Request.Form("AddToList") & " <BR></body></html> "
' **********************************************************
' Set the properties of the object
' TAL MAKE CHANGES HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!
' FROM WHO THE EMAIL WAS SENT (Apperra in email data)
objMessage.From = Request.Form("Email")
' TO WHOM the email will eb sent
objMessage.To = "[email protected]"
objMessage.Bcc = "[email protected],[email protected]"
' SUBJECT LINE
objMessage.Subject = "Enquiry from LK Designs Website – " & Request.Form("FirstName") & ", " & Request.Form("LastName")
'objMessage.TextBody = BodyString
objMessage.HtmlBody = BodyString
' Some useful extra variables
'objMessage.Cc = "[email protected];[email protected]"
'objMessage.Bcc = "[email protected];[email protected]"
' Send the message!
objMessage.Send
' Set the object to nothing because it immediately becomes
' invalid after calling the Send method.
Set objMessage = Nothing
' Set your Response after the Send Mail button is pushed.
Response.Write "&okS=1"
%>
פתרון קצת שונה
קצת איבדתי אותך בקובץ שליחת הדואר – יש שם מספר הגדרות שאיני מכיר ולא ברור למה צריך אותן.
אולי תנסה לשלוח לפי הקוד הבא (הוא מוצג גם בתשובה ל AVIL). זה קוד שעובד בטוח.
Set objCDO = Server.CreateObject("CDO.Message")
With objCDO
.From = "abc <[email protected]>"
.Subject = strSubject
.Organization = "abcd"
.To = strTo
.HtmlBody = sMail
.Send
End With
אשמח לקבל הסבר על הקוד שכתבת
אשמח לקבל הסבר על הקוד שכתבת
תודה
קצת פירוט
פרטתי לכל שורה מה היא עושה, אם משהו לא ברור אז תשאל.
Dim objCDO
'הגדרת אובייקט
Set objCDO = Server.CreateObject("CDO.Message")
With objCDO
'השם והמייל שלך
.From = "kola<[email protected]>"
'נושא המייל
.Subject = strSubject ' "נושא ההודעה שיופיע במייל"
'מייל הנימען
.To = strTo ' "[email protected]"
'גוף המייל
.HtmlBody = sMail 'HTML מייל שנישלח ב –
'אם אתה רוצה לשלוח מייל בצורת טקסט בלבד אז תשתמש במאפיין
'.TextBody=sMail
'שליחה
.Send
End With