Problem mit Mailformular

Xavier

Mitglied
Ich musste wegen einem Providerwechsel die Mailformulare eines Kunden neu in aps machen, was ich aber überhaupt nicht kenne. Nun habe ich zwar ein funktionierendes Script, aber der Absender sollte ja logischerweise nicht identisch mit dem Empfänger sein. Weiss jemand eventuell, was an untenstehendem Script zu ändern ist, damit die Mailadresse des Absenders angegeben wird? Weiss da jemand Abhilfe? Vielen Dank schon jetzt!

Hier erstmal das Script, das Formulat steht weiter unten:


<%@language = "VBscript"%>
<%
Response.Buffer = True
Set objFM = CreateObject("Scripting.Dictionary")
Set objMailx = CreateObject("CDO.Message")
Set objMailx = Nothing
%>

<%
'Empfänger Adresse
strRcpt = "info@meinedomain.ch"

'Absender Adresse
strDefFrom = "info@meindedomain.ch"
%>

<%
'Einlesen der Formulardaten
ParseForm
strOutX = SeqForm
If Len(strOutX) < 1 Then
strOutX = FormToString
End If

strSubject = strDefSubject
If objFM.Exists("TGsubject") Then
strSubject = objFM.Item("TGsubject")
End If

strFrom = strDefFrom
If Len(strFromVar) > 0 Then
If objFM.Exists(strFromVar) Then strFrom = objFM.Item(strFromVar)
End If

SendMail strFrom,strRcpt,strSubject,strOutX
If Len(strRedirect) > 0 Then
Response.redirect(strRedirect)
Response.End
End If

If objFM.Exists("TGredirect") = True Then
If Len(objFM.Item("TGredirect")) > 0 Then
Response.redirect(objFM.Item("TGredirect"))
Response.End
End If
End If
%>
<!-- Antwort, dass das Formular erfolgreich gesendet wurde -->



<%
Function IsValidEmail(Email)
Dim Temp,Temp2
End Function
%>

<%
'Deklarieren der Funktion SendMail
Function SendMail(From,Rcpt,Subject,Body)
Trim(From)
Set objMailer = CreateObject("CDO.Message")
objMailer.From = From
objMailer.To = Rcpt
objMailer.Subject = Subject
objMailer.TextBody = Body
objMailer.Send
Set objMailer = Nothing
End Function
%>


<%
'Deklarieren der Funktion ParseForm
Function ParseForm()
For Each Item in Request.Form
If objFM.Exists(Item) Then
objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)
Else
objFM.Add Item,Request.Form(Item)
End If
Next
For Each Item in Request.QueryString
If objFM.Exists(Item) Then
objFM.Item(Item) = objFM.Item(Item) & "," & Request.QueryString(Item)
Else
objFM.Add Item,Request.QueryString(Item)
End If
Next
End Function
%>
<%
Function SeqForm()
Dim Temp,strTmp,strOrder,strOut
If objFM.Exists("TGorder") = False Then
Exit Function
ElseIf isEmpty(objFM.Item("TGorder")) Then
Exit Function
End If
strOrder = objFM.Item("TGorder")
Temp = Split(strOrder,",",-1,1)
For Each strTmp in Temp
If objFM.Exists(strTmp) Then
strOut = strOut & strTmp & ": " & objFM.Item(strTmp) & Chr(10)
End If
Next
SeqForm = strOut
End Function
%>

<%
Function FormToString()
Dim strOut
strKeys = objFM.Keys
strValues = objFM.Items
For intCnt = 0 To objFM.Count -1
strOut = strOut & strKeys(intCnt) & ": " & strValues(intCnt) & Chr(10)
Next
FormToString = strOut
End Function
%>

<%
Function ReportError(strMess)
Response.Clear
%>

<%
Credit
Response.End
End Function
%>

<%Function Credit%>
<%End Function%>


Und jetzt das eigentliche Formular:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/Connections/connCMS.asp"-->
<%
Dim rsInhalt__MMColParam
rsInhalt__MMColParam = "22"
If (Request("MM_EmptyValue") <> "") Then
rsInhalt__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsInhalt
Dim rsInhalt_cmd
Dim rsInhalt_numRows

Set rsInhalt_cmd = Server.CreateObject ("ADODB.Command")
rsInhalt_cmd.ActiveConnection = MM_connCMS_STRING
rsInhalt_cmd.CommandText = "SELECT * FROM seiten WHERE ID = ?"
rsInhalt_cmd.Prepared = true
rsInhalt_cmd.Parameters.Append rsInhalt_cmd.CreateParameter("param1", 5, 1, -1, rsInhalt__MMColParam) ' adDouble

Set rsInhalt = rsInhalt_cmd.Execute
rsInhalt_numRows = 0
%>
<HTML>
<HEAD>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<TITLE>Mailforms</TITLE>
<META name="Title" content="Mailforms.">
<META name="Keywords" content="<%=(rsInhalt.Fields.Item("Keywords").Value)%>">
<META name="Description" content="Mailforms.">
<META name="Abstract" content="Mailforms">
<META name="audience" content="alle">
<META name="Robots" content="INDEX,FOLLOW">
<META name="Language" content="Deutsch">

<script type="text/javascript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function clearfield() {
document.kontakt.Nachricht.value = "";
}

function YY_checkform() { //v4.71
//copyright ©1998,2002 Yaromat.com
var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
for (i=1; i<a.length;i=i+4){
if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
o=MM_findObj(a.replace(/\[\d+\]/ig,""));
o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
v=o.value;t=a[i+2];
if (o.type=='text'||o.type=='password'||o.type=='hidden'){
if (r&&v.length==0){err=true}
if (v.length>0)
if (t==1){ //fromto
ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
} else if (t==2){
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
} else if (t==3){ // date
ma=a[i+1].split("#");at=v.match(ma[0]);
if(at){
cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
dte=new Date(cy,cm,cd);
if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
}else{err=true}
} else if (t==4){ // time
ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
} else if (t==5){ // check this 2
if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!o1.checked){err=true}
} else if (t==6){ // the same
if(v!=MM_findObj(a[i+1]).value){err=true}
}
} else
if (!o.type&&o.length>0&&o[0].type=='radio'){
at = a.match(/(.*)\[(\d+)\].*/i);
o2=(o.length>1)?o[at[2]]:eek:;
if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
if (t==2){
oo=false;
for(j=0;j<o.length;j++){oo=oo||o[j].checked}
if(!oo){s+='* '+a[i+3]+'\n'}
}
} else if (o.type=='checkbox'){
if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
} else if (o.type=='select-one'||o.type=='select-multiple'){
if(t==1&&o.selectedIndex/1==0){err=true}
}else if (o.type=='textarea'){
if(v.length<a[i+1]){err=true}
}
if (err){s+='* '+a[i+3]+'\n'; err=false}
}
if (s!=''){alert('Die benötigten Informationen sind unvollständig oder enthalten Fehler:\t\t\t\t\t\n\n'+s)}
document.MM_returnValue = (s=='');
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>

<body bgcolor="#e7e7e0" background="../../pics/navigation/background.gif" text="#c0c0c0" link="#804040" vlink="#804040" alink="#ff8000">

<DIV id="mailform" style="position: absolute; top: 0px; left: 500px; width: 400px; z-index: 0;">
<form onsubmit="YY_checkform('kontakt','Vorname','#q','0','Bitte geben Sie den Vornamen ein!','Name','#q','0','Bitte geben Sie den Namen ein!','Adresse','#q','0','Bitte geben Sie die Adresse ein!','PLZ','#q','0','Bitte geben Sie die PLZ ein!','Ort','#q','0','Bitte geben Sie den Ort ein!','Email','#S','2','Bitte geben Sie eine gültige E-Mail Adresse ein!');return document.MM_returnValue" action="mailer.asp" method="post" name="kontakt" id="kontakt">

<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" valign="top"><b><h3>Um Ihre Anfrage bearbeiten zu
können, benötigen wir folgende Informationen (* Pflichtfelder):</h3>
<br>
</strong></p> </p>
<p></td>
</tr>
<tr>
</tr>
<tr>
<br><td valign="top" width="161"><h3>Anrede</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td width="583" valign="top">
<select name="Anrede" id="Anrede">
<option selected="selected"> </option>
<option>Herr</option>
<option>Frau</option>
</select>
<input type="hidden" name="TGorder" value="Anrede,Firma,Vorname,Name,Adresse,PLZ,Ort,Land,Telefon,Fax,Email,woher kennen Sie unsere Firma,Das ist die Nachricht">
<!-- Betreff der Nachricht -->
<input type="hidden" name="TGsubject" value="Nachricht Kontaktformular ">
<input name="TGredirect" type="hidden" id="TGredirect" value="d_content-ausstellung-ok.asp"></td>
</tr>
<tr>
<td valign="top" width="161"><h3>Firma</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Firma" type="text" id="Firma" maxlength="40">
</td>
</tr>
<tr>
<td valign="top" width="161"><h3>Vorname*</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Vorname" type="text" id="Vorname" maxlength="40">
</td>
</tr>
<td valign="top" width="161"><h3>Name*</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Name" type="text" id="Name" maxlength="40">
</td>
<tr>
<td valign="top" width="161"><h3>Adresse*</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Adresse" type="text" id="Adresse" maxlength="40">
</td>
<tr>
<td valign="top" width="161"><h3>PLZ*</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="PLZ" type="text" id="PLZ" maxlength="40">
</td>
<tr>
<td valign="top" width="161"><h3>Ort*</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Ort" type="text" id="Ort" maxlength="40">
</td>
<tr>

<td valign="top" width="161"><h3>Land</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Land" type="text" id="Land" maxlength="40">
</td>
<tr>

<td valign="top" width="161"><h3>Telefon</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Telefon" type="text" id="Telefon" maxlength="40">
</td>
</tr>

<td valign="top" width="161"><h3>Fax</h3></td>
<td valign="top" width="18"><img src="pics/blank.gif" border="0" height="28" width="1" alt=""></td>
<td valign="top"><input name="Fax" type="text" id="Fax" maxlength="40">
</td>
</tr>
<tr>
<td valign="top"><h3>E-Mail*</h3></td>
<td valign="top"> </td>
<td valign="top"><input name="Email" type="text" id="Email" maxlength="40">
</td>
</tr>
</table><p>

<hr width="100%" align="center">

<h3><b>Woher kennen Sie unsere Firma?</b></h3>

<table width="250">
<tr>
<td>
<input name="woher kennen Sie unsere Firma" type="checkbox" id="woher kennen Sie unsere Firma" value="Empfehlung">Empfehlung

</td>
<td >
<input name="woher kennen Sie unsere Firma" type="checkbox" id="woher kennen Sie unsere Firma" value="Suchmaschine">Suchmaschine</td>
</tr>
<tr>
<td>
<input name="woher kennen Sie unsere Firma " type="checkbox" id="woher kennen Sie unsere Firma " value="Inserat">Inserat
</td>
<td >
<input name="woher kennen Sie unsere Firma" type="checkbox" id="woher kennen Sie unsere Firma" value="Internetseite">Internetseite
</td>
</tr>
<tr>
<td>
<input name="woher kennen Sie unsere Firma" type="checkbox" id="woher kennen Sie unsere Firma" value="Zeitungsartikel">Zeitungsartikel
</td>
<td >
<input name="woher kennen Sie unsere Firma" type="checkbox" id="woher kennen Sie unsere Firma" value="andere Quelle">andere Quelle
</td>
</tr>
</table>
<br>
<TABLE>
<TR>
<TD valign="top" width="80">Nachricht: <br>
<br>
<textarea name="Das ist die Nachricht" cols="43" rows="8" id="Das ist die Nachricht" onfocus="clearfield()">Bitte Frage oder Kommentar hier eingeben...</textarea>

</TD></TR>
</TABLE>

<table width="100%">
<tr>
<td>
<input name="Abschicken" type="submit" id="Abschicken" value="Senden">

</td>
<td>
<input name="reset" type="reset" value="Abbrechen">
</td>
</tr>
</table>

</form>

</DIV>

<DIV id="text" style="position: absolute; top: 22px; left: 122px; width: 400px; z-index: 1;">
<h1><%=(rsInhalt.Fields.Item("Ueberschrift").Value)%></h1>
<p>

<%=(rsInhalt.Fields.Item("Seiteninhalt").Value)%>

</DIV>

</body>

</html>
<%
rsInhalt.Close()
Set rsInhalt = Nothing
%>

 
Zurück
Oben