<%
Dim strTo, strSubject, strBody 'Strings for recipient, subject, boby
Dim objCDOMail 'The CDO object
'First we'll read in the values entered
strTo = "info@idroidea.it"
'strTo = "mravaglia66@virgilio.it"
'Request.Form("to")
'These would read the message subject and body if we let you enter it
'strSubject = Request.Form("subject")
'strBody = Request.Form("body")
' Both of these should be changed before you run this script.
strSubject = "Richiesta Informazioni inviate www.idroidea.it"
' This is multi-lined simply for readability
strBody = "Richiesta Informazioni inviate da www.idroidea.it "
' Some spacing:
strBody = strBody & vbCrLf & vbCrLf
strBody = strBody & "Ditta : " & Request.Form("Ditta:") & vbCrLf & vbCrLf
strBody = strBody & "Via : " & Request.Form("Via:")
strBody = strBody & " N° : " & Request.Form("N.:") & vbCrLf & vbCrLf
strBody = strBody & "Cittą: : " & Request.Form("citta':")
strBody = strBody & " CAP : " & Request.Form("CAP")
strBody = strBody & " Provincia: " & Request.Form("provincia:") & vbCrLf & vbCrLf
strBody = strBody & "Settore d'attivita' : " & Request.Form("settore d'attivita'") & vbCrLf & vbCrLf
strBody = strBody & "Incarico ricoperto : " & Request.Form("incarico:") & vbCrLf & vbCrLf
strBody = strBody & "Nome : " & Request.Form("Nome:")
strBody = strBody & " Cognome : " & Request.Form("cognome:") & vbCrLf & vbCrLf
strBody = strBody & " Telefono : " & Request.Form("telefono:")
strBody = strBody & " Fax : " & Request.Form("fax:") & vbCrLf & vbCrLf
strBody = strBody & "Desidero ricevere informazioni su : " & Request.Form("info su:") & vbCrLf & vbCrLf
strBody = strBody & "Altre informazioni : " & Request.Form("altre info:") & vbCrLf & vbCrLf
strBody = strBody & "E-mail : " & Request.Form("to")
' A final carriage return for good measure!
strBody = strBody & vbCrLf
'Ok we've got the values now on to the point of the script.
'We just check to see if someone has entered anything into the to field.
'If it's equal to nothing we show the form, otherwise we send the message.
'If you were doing this for real you might want to check other fields too
'and do a little entry validation like checking for valid syntax etc.
' Note: I was getting so many bad addresses being entered and bounced
' back to me by mailservers that I've added a quick validation routine.
'If Request.Form("to") = "" Or Not IsValidEmail(strTo) Then
if Request.Form("Ditta:")="" then
%>
<%
Else
Set objCDOMail = Server.CreateObject("CDO.Message")
objCDOMail.From = "info@idroidea.it"
objCDOMail.To = strTo
'objCDOMail.Cc = "altroindirizzo@aruba.it;ancora@aruba.it"
'objCDOMail.Bcc = "altroindirizzo@aruba.it;ancora@aruba.it"
objCDOMail.Subject = strSubject
objCDOMail.TextBody = strBody
'objCDOMail.HTMLBody= strBody
'MiaMail.AddAttachment "d:\inetpub\webs\tuodominiocom\file.zip"
objCDOMail.Fields("urn:schemas:mailheader:Keywords") = "website"
objCDOMail.Fields("urn:schemas:httpmail:importance") = 2
objCDOMail.Fields("urn:schemas:mailheader:X-Priority").Value = 2
objCDOMail.Fields("urn:schemas:mailheader:X-MSMail-Priority") = 2
objCDOMail.Fields("urn:schemas:mailheader:Sensitivity") = "Company-Confidential"
objCDOMail.Fields.Update()
objCDOMail.Send()
Set objCDOMail = Nothing
Response.Write "Messaggio inviato a: " & strTo
Response.Write ""
Response.Write ""
Response.Write "Torna al'inizio"
'Response.Write "Message ARE NO LONGER BEING SENT because of all the abuse the system was receiving!"
End If
' End page logic
%><% ' Only functions and subs follow!
' A quick email syntax checker. It's not perfect,
' but it's quick and easy and will catch most of
' the bad addresses than people type in.
Function IsValidEmail(strEmail)
Dim bIsValid
bIsValid = True
If Len(strEmail) < 5 Then
bIsValid = False
Else
If Instr(1, strEmail, " ") <> 0 Then
bIsValid = False
Else
If InStr(1, strEmail, "@", 1) < 2 Then
bIsValid = False
Else
If InStrRev(strEmail, ".") < InStr(1, strEmail, "@", 1) + 2 Then
bIsValid = False
End If
End If
End If
End If
IsValidEmail = bIsValid
End Function
%>