22 gennaio 2003 alle 13:25:50 Spero ti riferisca all'uso di CDOSYS al posto di CDONTS... In questo caso, ho una notizia buona ed una cattiva: la buona e' che ho completato la nuova versione del file 'includesmail-inc.asp' ed ho preparato le istruzioni per modificare tutti i moduli che conosco che inviano posta. La brutta e' che sul mio server funziona solo CDOSYS, quindi l'ho provata solo con questo componente e solo nel caso dell'invio della password dimenticata. Qualcuno sarebbe cosi' gentile da testarla anche in altri casi e con altri componenti? Ciao e grazie
Emu
MODULO cdonts_aspnuke_email
file send_mail.asp aggiungere <!-- #include file='includes/mail-inc.asp' --> sostituire tutto il codice riguardante cdonts con la riga:
file go_sendfriend.asp aggiungere <!-- #include file='includes/mail-inc.asp' --> sostituire tutto il codice riguardante cdonts con la riga:
SendMail strFrom, strTo, "Un amico vuole mostrarti una cosa su www.bisiacaria.com ...", strFrom & " pensa che forse questa cosa vista su www.bisiacaria.com può interessarti:" & VbCrLf & VbCrLf & Trim(Request.Form("URL")) & VbCrLf & VbCrLf & Trim(Request.Form("message") & VbCrLf & VbCrLf & VbCrLf & "Questa mail è stata inviata utilizzando il sistema ""Avvisa un amico"" di Bisiacaria.com!. "& VbCrLf &"La tua email non è stata utilizzata in nessun altro modo."), false
MODULO NewsLetter2.1
file go_newsletter.asp aggiungere <!-- #include file='includes/mail-inc.asp' --> sostituire il codice dentro il ciclo "While" con il seguente codice:
While Not oRs.EOF SendMail "" & GLOBAL_SITE_EMAIL & "", oRs("uEmail"), subject, HTML, true n=n+1 oRs.MoveNext Wend
Il componente utilizzato ed i suoi parametri sono impostati definitivamente nel file 'includes/mail-inc.asp'
'lasciare solo i servizi che si possono/vogliono utilizzare Const SMTP_SERVICE = "CDONTS|ASPEMAIL|JMAIL|CDOSYS"
'parametri per ASPEMAIL|JMAIL|CDOSYS Const SMTP_HOST = "xxxxx" 'host del server di posta Const SMTP_PORT = "25" 'valore di default, va cambiato solo se necessario
'parametri per CDOSYS Const SMTP_USER = "yyyyyy" 'utente utilizzato per autenticarsi Const SMTP_PWD = "zzzzzz" 'password dell'utente
' Send mail with any component ' IN : sSender (string) : sender of the mail ' : sRecipient (string) : recipient of the mail (can use ; to send to many recipients) ' : sSubject (string) : subject of the mail ' : sText (string) : content of the mail ' : bHTML (boolean) : send HTML or text mail ' OUT : (boolean) : True Function SendMail(ByVal sSender, ByVal sRecipient, ByVal sSubject, ByVal sText, ByVal bHTML) Dim sCC Dim sBCC
Function SendMailExtended(ByVal sSender, ByVal sRecipient, ByVal sCCRecipient, ByVal sBCCRecipient, ByVal sSMTPServer, ByVal sSMTPPort, ByVal sSMTPUser, ByVal sSMTPPwd, ByVal sSubject, ByVal sText, ByVal bHTML, ByVal iPriority, ByVal sMailService) Dim oMail Dim oConfig Dim sHTMLText Dim aRecip Dim bCDONTS Dim bCDOSYS Dim bASPEMAIL Dim bJMAIL
On Error Resume Next sHTMLText = "<html><body>" & vbCRLF & Text2HTML(sText) & vbCRLF & "</body></html>" On Error Goto 0
'PRIMA PROVO CDONTS if instr(sMailService, "CDONTS") > 0 then On Error Resume Next Set oMail = Server.CreateObject("CDONTS.NewMail") If Err <> 0 Then Err.Clear bCDONTS = False set oMail = nothing Else bCDONTS = True End If On Error Goto 0 else bCDONTS = False end if if bCDONTS then 'CDONTS If bHTML Then oMail.BodyFormat = 0 oMail.MailFormat = 0 oMail.Body = sHTMLText Else oMail.BodyFormat = 1 oMail.MailFormat = 1 oMail.Body = sText End If
if trim(sCCRecipient) <> "" then oMail.Cc = sCCRecipient end if if trim(sBCCRecipient) <> "" then oMail.Bcc = sBCCRecipient end if
oMail.From = sSender oMail.Subject = sSubject
On Error Resume Next oMail.Send If Err <> 0 Then Err.Clear SendMailExtended = False Else SendMailExtended = True End If On Error Goto 0 set oMail = nothing else 'POI PROVO ASPEMAIL if instr(sMailService, "ASPEMAIL") > 0 then On Error Resume Next Set oMail = Server.CreateObject("Persits.MailSender") If Err <> 0 Then Err.Clear bASPEMAIL = False set oMail = nothing Else bASPEMAIL = True End If On Error Goto 0 else bASPEMAIL = False End If if bASPEMAIL then 'ASPEMAIL oMail.Host = sSMTPServer oMail.Port = sSMTPPort oMail.From = sSender oMail.FromName = sSender oMail.Subject = sSubject oMail.IsHTML = bHTML
oMail.Priority = 5 - (2 * iPriority) '(1,3,5) If bHTML Then oMail.Body = sHTMLText Else oMail.Body = sText End If
if instr(sRecipient,",") > 0 then aRecip = split(sRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddAddress trim(aRecip(i)) end if next else oMail.AddAddress sRecipient end if
if instr(sCCRecipient,",") > 0 then aRecip = split(sCCRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddCc trim(aRecip(i)) end if next else if trim(sCCRecipient) <> "" then oMail.AddCc sCCRecipient end if end if
if instr(sBCCRecipient,",") > 0 then aRecip = split(sBCCRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddBCc trim(aRecip(i)) end if next else if trim(sBCCRecipient) <> "" then oMail.AddBCc sBCCRecipient end if end if
On Error Resume Next oMail.Send If Err <> 0 Then Err.Clear SendMailExtended = False Else SendMailExtended = True End If On Error Goto 0 set oMail = nothing 'FINE ASPEMAIL else 'POI PROVO JMAIL if instr(sMailService, "JMAIL") > 0 then On Error Resume Next Set oMail = Server.CreateObject("JMail.SMTPMail") If Err <> 0 Then Err.Clear bJMAIL = False set oMail = nothing Else bJMAIL = True End If On Error Goto 0 else bJMAIL = False end if if bJMAIL then 'JMAIL oMail.ServerAddress = sSMTPServer & ":" & sSMTPPort oMail.Sender = sSender oMail.Subject = sSubject oMail.HTMLBody = sHTMLText oMail.Priority = 5 - (2 * iPriority) '(1,3,5)
if instr(sRecipient,",") > 0 then aRecip = split(sRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddRecipient trim(aRecip(i)) end if next else oMail.AddRecipient sRecipient end if
if instr(sCCRecipient,",") > 0 then aRecip = split(sCCRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddRecipientCC trim(aRecip(i)) end if next else if trim(sCCRecipient) <> "" then oMail.AddRecipientCC sCCRecipient end if end if
if instr(sBCCRecipient,",") > 0 then aRecip = split(sBCCRecipient, ",") for i = 0 to Ubound(aRecip) if trim(aRecip(i)) <> "" then oMail.AddRecipientBCC trim(aRecip(i)) end if next else if trim(sBCCRecipient) <> "" then oMail.AddRecipientBCC sBCCRecipient end if end if
'FINE JMAIL set oMail = nothing else 'INFINE PROVO CDOSYS if instr(sMailService, "CDOSYS") > 0 then On Error Resume Next Set oMail = Server.CreateObject("CDO.Message") If Err <> 0 Then Err.Clear bCDOSYS = False set oMail = nothing Else bCDOSYS = True End If On Error Goto 0 else bCDOSYS = False end if if bCDOSYS then 'CDOSYS Set oConfig = Server.CreateObject("CDO.Configuration") 'Configuration: oConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 oConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sSMTPServer oConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CInt(sSMTPPort) oConfig.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 oConfig.fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sSMTPUser oConfig.fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sSMTPPwd oConfig.fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30 'Update configuration oConfig.Fields.Update Set oMail.Configuration = oConfig 'message body If bHTML Then oMail.HTMLBody = sHTMLText Else oMail.TextBody = sText End If oMail.Fields.Item("urn:schemas:httpmail:importance") = iPriority oMail.Fields.Update() 'FINE CDOSYS
oMail.To = sRecipient if trim(sCCRecipient) <> "" then oMail.Cc = sCCRecipient end if if trim(sBCCRecipient) <> "" then oMail.Bcc = sBCCRecipient end if
oMail.From = sSender oMail.Subject = sSubject
On Error Resume Next oMail.Send If Err <> 0 Then Err.Clear SendMailExtended = False Else SendMailExtended = True End If On Error Goto 0
set oConfig = nothing set oMail = nothing else SendMailExtended = False end if end if end if end if End Function
22 gennaio 2003 alle 13:32:40 Non so se l'utente medio sara' in grado di capire esattamente cosa intendo quando dico
sostituire tutto il codice riguardante cdonts con la riga:
ma certamente lo saranno gli autori dei rispettivi moduli, che potrebbero quindi aggiornarli e renderne eventualmente disponibile la nuova versione. Ciao