Problemi con invio form via mail

legolas

Nuovo Utente
25 Giu 2007
10
0
0
Ciao ragazzi,
vorrei fare una cosa banalissima, ovvero inviare una il risultato di una form compilata su di un indirizzo mail...
Ho scaricato una miriade di script ma mi sfugge qualche passaggio e non riesco a farli funzionare!:incazz2:

In uno di questi script, quello che vi riporto integralmente qui sotto, viene chiesto come vedrete una mail di destinazione (la mail presso cui arriveranno i messaggi, mentre le restanti parti della form, compreso l'indirizzo del mittente, vengono inseriti dall'utente che tenta l'invio. Io mi sono chiesto: ma come cavolo fa lo script ad inoltrare una form verso un indirizzo E-mail se non si connette ad un server SMTP previa autenticazione??!!!!

Ecco lo script... non da nessun errore, ma non funziona!!!!!:dipser:

<%@ Language = "VBScript" %>
<%
Select Case Request.Querystring("Action")
Case "Send"

on error resume next
'Set variables
Dim BackURL
Dim strName
Dim strEmail
Dim strSubject
Dim strMessage
Dim strUserIP
Dim strToEmail
Dim daCdoMail

'Replace this email with your real email id
strToEmail = "[email protected]"
BackURL = Request.ServerVariables("HTTP_REFERER")
strName = Request.form("Name")
strEmail = Request.form("Email")
strSubject = Request.form("Subject")
strMessage = Request.form("Message")
strUserIP = Request.ServerVariables("REMOTE_ADDR")

'Create Mail Object
Set daCdoMail = CreateObject("CDONTS.NewMail")
daCdoMail.To = strToEmail
daCdoMail.From = strEmail
daCdoMail.Subject = strSubject
daCdoMail.Body = "<font size=""small"">This message was sent by " & strName & " at " & Now() & ". </font><br><br>" & strMessage & _
"<hr height=""1""><font size=""2""><b>ASP Contact Form Script </b>Powered by <b><font color=""#FF0000"">DigitalArakan</font></b><br>" & _
"</font><a href=""http://www.digitalarakan.net"">http://www.digitalarakan.net</font></a>"
'You can change the mail body format setting below
'0 = HTML, 1 = TEXT
daCdoMail.BodyFormat = 0
'You can change the mail format setting below
'0 = HTML, 1 = TEXT
daCdoMail.MailFormat = 0
'Set Server Side Validation to make sure we got both sender and recipient email Id to send email
If strToEmail = "" OR strEmail = "" Then
Session("msg") = "Sender Email or Resipient Email is blank. This message can not be sent. Please try again"
Response.redirect (BackURL)
Else
'Now send email to the address you specified at line no. 16
daCdoMail.Send
End If
'Destroy mail object
Set daCdoMail = Nothing

'Create result text in a Sesion
Session("MsgSent") = "Your email with subject [<b>" & strSubject & "</b>] has been sent. Thank you for writing to us."
'Redirect and show the result
Response.redirect (BackURL)
End Select
%>
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>ASP Contact Form Version 1 Powered by DigitalArakan</title>
<meta name="Naing Win - DigitalArakan - http://www.digitalarakan.net" content="Author">
<SCRIPT language=javascript>
function check()
{
if (document.myform.Name.value.length==0)
{
alert("Please enter your Name");
document.myform.Name.focus();
}
else if(document.myform.Email.value.length==0 || document.myform.Email.value.indexOf("@")==-1 || document.myform.Email.value.indexOf(".")==-1 || document.myform.Email.value.indexOf(" ")==0)
{
alert("You must enter a Valid Email ID")
document.myform.Email.focus();
}
else if (document.myform.Subject[document.myform.Subject.selectedIndex].value.length==0)
{
alert("Please select a Subject");
document.myform.Subject.focus();
}
else if(document.myform.Message.value==0)
{
alert("Message field cannot be left empty");
document.myform.Message.focus();
}

else
{
document.myform.submit()
}
}
</SCRIPT>
<style>
<!--
h3 { font-family: Tahoma; font-size: 14pt; color: #003399; font-weight: bold }
td { font-family: Tahoma; font-size: 11pt }
-->
</style>
</head>

<body>
<%If Session("msgSent") = "" Then%>
<table cellSpacing="1" border="0" bordercolor="#111111" id="table1" width="100%">
<form action="Contact.asp?Action=Send" method="post" name="myform">

<tr>
<td align="right" colspan="2">
<h3 align="left">Contact Form</h3>
</td>
</tr>
<tr>
<td colspan="2">
If you want to contact us for any questions or suggestions, then please fill the form correctly and send it to us by hitting the
'Send Message' button.</td>
</tr>
<%If Session("msg") <> "" Then%>
<tr>
<td colspan="2">
<font size="1" color="#FF0000"><%=Session("msg")%></font>&nbsp;</td>
</tr>
<%End If%>
<tr>
<td colspan="2">
&nbsp;</td>
</tr>
<tr>
<td class="nortex">Your Name:</td>
<td class="nortex">
<input maxLength="25" size="37" name="Name" value="<%= Request.form("Name") %>"></td></tr>
<tr>
<td class="nortex">Your Email:</span></td>
<td class="nortex">
<input maxLength="25" size="37" name="Email" value="<%= Request.form("Email") %>"></td></tr>
<tr>
<td class="nortex">Subject:</td>
<td class="nortex"><select name="Subject">
<option selected>Select Subject</option>
<option value="Question">Question</option>
<option value="Suggestion">Suggestion</option>
<option value="Broken Link" Links>Broken Links</option>
<option value="None of the above" of the above>None of the above</option></select> </td></tr>
<tr>
<td class="nortex" valign="top">Your Message:</td>
<td class="nortex">
<textarea name="Message" rows="12" cols="48"><%= Request.form("Message") %></textarea></td></tr>
<tr>
<td class="nortex">&nbsp;</td>
<td class="nortex">
<input onclick="check()" type="button" value="Send Message" name="sendmessage" style="float: center; font-weight:bold"></td></tr>
<tr>
<td class="nortex" colspan="2">&nbsp;</td>
</tr>
<tr>
<td class="nortex" colspan="2">

<%
'DO NOT REMOVE THIS LINE
Response.write "<p></p><p align=""center""><font size=""1""><b>ASP Contact Form Script </b>Powered by <b><font color=""#FF0000"">DigitalArakan</font></b><br>" & _
"</font><a href=""http://www.digitalarakan.net"" target=""_blank""><font size=""1"">http://www.digitalarakan.net</font></a>"
%>

</td>
</tr>
</form>
</table>
<%Else%>
<table cellSpacing="1" border="0" bordercolor="#111111" id="table2" width="100%">


<tr>
<td align="right">
<h3 align="left">Message Sent</h3>
</td>
</tr>
<tr>
<td>
<font size="1" color="#FF0000"><%=Session("MsgSent")%></font>&nbsp;</td>
</tr>
<tr>
<td>
<%
'DO NOT REMOVE THIS LINE
Response.write "<p>&nbsp;</p>&nbsp;<p><p align=""center""><font size=""1""><b>ASP Contact Form Script </b>Powered by <b><font color=""#FF0000"">DigitalArakan</font></b><br>" & _
"</font><a href=""http://www.digitalarakan.net"" target=""_blank""><font size=""1"">http://www.digitalarakan.net</font></a>"
%>

</td></tr>
</table>
<%End If
'Destroy session variables
Session("MsgSent") = ""
Session("msg") = ""
%>
</body>

</html>
 

legolas

Nuovo Utente
25 Giu 2007
10
0
0
Ho provato con lo script da ASPcenter, ma non funziona lo stesso! Mi da errore generico 500.
Chiaramente ho impostato mail corrette, ma niente da fare. La cosa che continuo a non capire è questa: quando metto su di un link il mailto al clic si apre il client di posta configurato e viene inviata la mail... Ma qui in teoria, io potrei mettere come mittente una mail qualsiasi, anche non reale, perché non c'è nessuna richiesta di credenziali come user e password del mittente?!!! Come fa ad arrivare questa benedetta mail? che server SMTP la inoltra!!!??? Vi prego ragazzi aiutatemi a capire:dipser:

<%@LANGUAGE = VBScript%>
<%
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
With MyMail
To = "[email protected]"
From = "[email protected]"
Subject = "Benvenuto CDOSYS!"
HTMLBody = "<b>Speriamo di trovarci bene insieme :)</b>"
Send
End With
Set MyMail = Nothing
Response.Write "Email inviata con successo!"
%>
 
Discussioni simili
Autore Titolo Forum Risposte Data
G Invio Mail con PHPMailer, problemi SMTP PHP 7
P problemi invio email con phpmailer PHP 47
C Problemi con l'invio di un modulo web PHP 5
D PROBLEMI invio posta con php PHP 3
V problemi con l'invio di allegato in un form PHP 17
I [Risolto] Problemi invio e-mail con CDOSYS con domini @live.it Classic ASP 4
P Problemi con phpmail ed invio email PHP 0
L problemi con invio dati Form a Database PHP 2
1 problemi con invio PHP PHP 11
Angel0 Problema invio e-mail (era: problemi con xoom) Posta Elettronica 4
G Problemi con l'invio email da un host remoto PHP 2
V problemi con invio email in formato html PHP 1
T problemi con dati menu a tendina HTML e CSS 2
M Upload immagine con javascript problemi con FormData() Javascript 1
A Problemi con move_uploaded_file PHP 7
M Problemi con la stampa dei valori in php PHP 1
L Problemi con il login PHP 2
R Tutto su utf-8 ma ancora problemi con i caratteri speciali in mysql MySQL 1
Z problemi con foreach insert into PHP 10
B javascript per problemi con pdf e Safari Javascript 0
M Problemi con creazione maschere Presentati al Forum 1
M Problemi con query a più tabelle PHP 3
S Problemi delle funzioni eliminate con PHP e MySQL PHP 4
M Problemi con blog Grav CMS (Content Management System) 0
S incoerenza di stampa. problemi con il magenta Photoshop 3
A problemi con paypall Java 1
S Problemi con modulo upload video php (help!) PHP 0
felino [Windows 8.1] Problemi con connessione WiFi Windows e Software 0
E [PHP] problemi nuova riga con fwrite su piattaforma android PHP 5
O [HTML] problemi con la regola "background-attachment: fixed" in EDGE HTML e CSS 0
M [PHP] Problemi con query unione PHP 11
M [PHP] Problemi con select PHP 6
ANDREA20 [HTML] problemi con il footer HTML e CSS 1
D [MS Access] problemi con inserimento campo in una maschera MS Access 6
M [PHP] Problemi con il riconoscimento login. PHP 21
A [WordPress] problemi con xampp WordPress 2
M Problemi con database Apache/2.4.37 (Win32) OpenSSL/1.1.1a PHP/7.3.1 PHP 6
S [PHP] problemi con le sessioni PHP 3
T [PHP] problemi con il browser PHP 0
Andrea_Ventura [HTML] Problemi con effetto hover HTML e CSS 5
M [PHP] Problemi con login facebook PHP 0
Andrea_Ventura [HTML] Problemi con visualizzazione Navigation Bar HTML e CSS 10
andreas88 Creare file .htaccess per risolvere alcuni problemi con il tester SEO SEO e Posizionamento 0
Eugene [Joomla] Problemi con modulo per strutture alberghiere JHotelreservation starter Joomla 6
F [PHP] Problemi di base con bot di telegram PHP 9
M [Photoshop] Problemi con importazione immagini trasparenti in indesign Photoshop 0
E [Photoshop] Problemi con dimensioni immagini Photoshop 12
G [HTML] Problemi con inserimento immagini HTML e CSS 7
L Problemi con Javascript e Mustache Javascript 0
A [Javascript] problemi con javascrip e posizione GPS html5 Javascript 6

Discussioni simili