Salve, ho scaricato questa funzione, l'invio delle email dal web.
Ho scelto questa perchè c'è la possibilità di inviare anche gli allegati, apro i file, li legge, ma non li invia, infatti le email arrivano sempre senza.
Sapete aiutarmi a capire dovè il problema???

Grazie
codice:
<%@LANGUAGE = "VBSCRIPT"%>
<%
' ================== MAILSENDER v. 1.0 ==================
' Code compiled by Will Collis [will@netsibition.co.uk]
'
' I do not provide any warranty or support.
' I am NOT liable for any use or misuse of this script.
' If you have any problems or queries. Google for it.
' HTMLArea v2 is by InteractiveTools [www.htmlarea.com]
'
' NB: The attachment functionality sends files from the
' computer that the script resides on. For Localhost use
' you are OK to attach. If you are using this on a server
' you should remember that the file path relates to the
' server's file structure, even the though the dialogue
' box asks for files on the client computer. You should
' remove or modify this yourself if this is a problem.
'
' If I get the time, I may well release a full-blown "v.2"
' with various email component support and a file upload
' for better attachment management. Thanks & Enjoy.
' =======================================================

'Begin with basic RegExp function to validate email addresses
Function EmailCheck(sEmail)
  EmailCheck = false
  Dim regEx, retVal
  Set regEx = New RegExp
  regEx.Pattern ="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$" 
  regEx.IgnoreCase = true
  retVal = regEx.Test(sEmail)
  If not retVal Then
    exit function
  End If
  EmailCheck = true
End Function

DateTime = Now() 'Store current time as variable
%>
<html>
<head>
<title>Email Sender</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
a:link 		{ color: #666666; text-decoration: underline; }
a:visited 	{ color: #666666; text-decoration: underline; }
a:active 	{ color: #666666; text-decoration: underline; }
a:hover 	{ color: #666666; text-decoration: underline; }

.text { font-family: Georgia, Times New Roman, serif; font-size: 13px; color: #777777; }
.fmtext { font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 12px; color: #777777; }

.button {
  background-color:#F9CC34;
  border: 1px solid #E3A035;
  background-image: url(images/bu_orange.gif);
  font-family: Tahoma, Arial, sans-serif;
  font-size: 12px; font-weight: bold;
  color: #717171;
  height: 25px;
  cursor: hand;
}

input {
	padding:3px;
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #777777;
	border: 1px solid #F0D8A9;
	background-image: url(images/input_bg.gif);
	background-repeat: repeat-x;
	height:22px;
}

textarea {
	padding:3px;
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #777777;
	border: 1px solid #F0D8A9;
	background-image: url(images/input_bg.gif);
	background-repeat: repeat-x;
	background-position: top left;
	background-color: #FBFBD1;
}

select {
	font-family: Tahoma, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #777777;
	border: 1px solid #F0D8A9;
	background-color: #FBFBD1;
}
</style>
<script language="Javascript1.2">
<!-- // load htmlarea
_editor_url = "htmlarea/";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// -->
</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="50%" border="0" cellspacing="5" cellpadding="0" class="text">
  <tr> 
    <td>Welcome to MailSender!</td>
  </tr>
  <tr> 
    <td><%
If Request.Querystring("send") = "True" Then
fmTo		= Trim(Request.Form("fmTo"))
fmFrom		= Trim(Request.Form("fmFrom"))
fmFromname	= Trim(Request.Form("fmFromName"))
fmCC		= Trim(Request.Form("fmCC"))
fmSubject	= Trim(Request.Form("fmSubject"))
fmBody		= Trim(Request.Form("fmBody"))
fmAttach	= Request.Form("fmAttach")

Call SendMail(fmTo,fmFrom,fmFromName,fmCC,fmSubject,fmBody,fmAttach)

Else
Response.Write("Please complete the form below to send your message.")
End If
	%></td>
  </tr>
  <tr> 
    <td><hr></td>
  </tr>
  <tr> 
    <td bgcolor="#EEEEEE"> 
      <table width="100%" border="0" cellspacing="5" cellpadding="0" class="fmtext">
        <col align="right" width="40%"><col align="left" width="60%"> 
		<form name="sendmail" method="post" action="default.asp?send=True">
        <tr> 
          <td>Recipient's Email</td>
          <td><input type="text" name="fmTo" value="<%=fmTo%>" size="43"></td>
        </tr>
        <tr> 
          <td>Sender's Email</td>
          <td><input type="text" name="fmFrom" value="<%=fmFrom%>" size="43"></td>
        </tr>
        <tr> 
          <td>Sender's Name</td>
          <td><input type="text" name="fmFromName" value="<%=fmFromName%>" size="43"></td>
        </tr>
        <tr> 
          <td>CC</td>
          <td><input type="text" name="fmCC" value="<%=fmCC%>" size="43"></td>
        </tr>
        <tr> 
          <td>Subject</td>
          <td><input type="text" name="fmSubject" value="<%=fmSubject%>" size="43"></td>
        </tr>
        <tr> 
          <td colspan="2" align="center">
			<textarea name="fmBody" style="width:100%; height:200px;">
			<%=fmBody%>
			</textarea>

			<script language="javascript1.2">
			var config = new Object();    // create new config object
			
			config.width = "100%";
			config.height = "200px";
			config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
			config.debug = 0;
			
			config.toolbar = [
				['fontname','fontsize'],
				['separator','forecolor','backcolor','separator','popupeditor'],
				['linebreak'],
				['bold','italic','underline','separator'],
				['justifyleft','justifycenter','justifyright','separator'],
				['OrderedList','UnOrderedList','separator','Outdent','Indent','separator'],
				['strikethrough','subscript','superscript','separator'],
				['HorizontalRule','Createlink','htmlmode'],
			];
			
			config.fontnames = {
				"Arial":           "arial, helvetica, sans-serif",
				"Courier New":     "courier new, courier, mono",
				"Georgia":         "Georgia, Times New Roman, Times, Serif",
				"Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
				"Times New Roman": "times new roman, times, serif",
				"Verdana":         "Verdana, Arial, Helvetica, sans-serif",
				"impact":          "impact",
				"WingDings":       "WingDings"
			};
			config.fontsizes = {
				"8 pt":  "1",
				"10 pt": "2",
				"12 pt": "3",
				"14 pt": "4",
				"18 pt": "5",
				"24 pt": "6",
				"36 pt": "7"
			  };
			
			editor_generate('fmBody',config);
			</script>
		  </td>
        </tr>
        <tr>
          <td>Attachment</td>
          <td><input type="file" name="fmAttach" value="<%=fmAttach%>" size="43"></td>
        </tr>
        <tr> 
          <td><input type="reset" name="fmReset" value="Clear Fields" class="button"></td>
          <td><input type="submit" name="fmSubmit" value="Send Mail &raquo;" class="button"></td>
        </tr>
      </form>
	  </table>
    </td>
  </tr>
  <tr> 
    <td></td>
  </tr>
</table>
</body>
</html>
<%
'Begin Routine to Send Mail
Sub SendMail(smTo,smFrom,smFromName,smCC,smSubject,smBody,smAttach)
On Error Resume Next 'To catch any potential errors in the sending

strErr = "" 'Init variable to store any error message

If EmailCheck(smTo) = False Then
strErr = strErr & "[*]Recipient's Email Address is not valid"
End If
If EmailCheck(smFrom) = False Then
strErr = strErr & "[*]Sender's Email Address is not valid"
End If
If Len(smFromName) > 0 Then
smFromage = smFromName & "<" & smFrom & ">"
End If

If strErr = "" Then 'If form data has passed basic validation then send

Set iMsg		= CreateObject("CDO.Message")
With iMsg
	.To			= smTo
	.From		= smFromage
	If Len(smCC) > 0 Then
	.CC			= smCC
	End If
	.Subject	= smSubject
	.HTMLBody	= smBody
	If Len(smAttach) > 0 Then
	Set iBp =  .AddAttachment(smAttach)
	End If	
	.Send
End With

'Clean Up
Set iMsg = Nothing
If Len(smAttach) > 0 Then
Set iBp = Nothing
End If

If Err > 0 Then 'If a server/component error occurred
Response.Write("Mail Not Sent! Error(s) Occurred:")
Response.Write("<ul>[*]" & Err.Description & "<ul>")
Else 'Success! Mail Sent
Response.Write("Mail Sent!
To: " & smTo & " on " & FormatDateTime(DateTime,vbLongDate) & " at " & FormatDateTime(DateTime,vbLongTime))
smTo = ""
smFrom = ""
smFromName = ""
smCC = ""
smSubject = ""
smBody = ""
smAttach = ""
End If

Else 'Else, Form data incorrect - write out the error(s)
Response.Write("Mail Not Sent! Error(s) Occurred:")
Response.Write("<ul>" & strErr & "</ul")
End If
End Sub
%>