<%@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 %> ..:: Edasim srl ::..:: Contabilità & Fisco ::..

L'Esperto Risponde

Cos'è L'Esperto Risponde?

L'Esperto Risponde è il servizio di consulenza che Edasim srl mette a disposizione dei propri clienti per supportarli in merito ai principali quesiti di natura fiscale, giuridica e amministrativa. Con L'Esperto Risponde puoi:

  • Inviare un quesito direttamente ai nostri esperti, compilando il form online.

 
<% 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 %>

A
Da
Mittente
CC
Oggetto

Allegati
 
 

 

 
<% '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("