no non sono in locale. Se vuoi ti posto nuovamente il codice
P.S. Ah...ho dimenticato: Grazie!
no non sono in locale. Se vuoi ti posto nuovamente il codice
P.S. Ah...ho dimenticato: Grazie!
Ok riposta.Originariamente inviato da darlette
no non sono in locale. Se vuoi ti posto nuovamente il codice
P.S. Ah...ho dimenticato: Grazie!
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim strMittente
Dim strEmailA
Dim strOggetto
Dim utenti
Dim messaggio
strOggetto= Request.Form("Oggetto")
messaggio=Request.form("Message")
utenti=Request.form("checkbox")
Set objEMail = Server.CreateObject("CDONTS.NewMail")
'objEMail.AttachURL Server.MapPath("/images/bg_mail.jpg"), "bg_mail.jpg"
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//IT"">"
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<title>prova</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body background=""images/bg_mail.jpg"">"
HTML = HTML &messaggio
HTML = HTML & "</body>"
HTML = HTML & "</html>"
VirtualFolder = "images"
NewFileName = "bg_mail.jpg"
virtDestinationPath = "http://" + Request.ServerVariables("SERVER_NAME") + GetPath(Request.ServerVariables("SCRIPT_NAME") ) + VirtualFolder + "/" + NewFileName
response.write virtDestinationPath & "
"
response.end
if inStr(utenti," ") > 0 then utenti = replace(utenti," ","")
if inStr(utenti,",") > 0 then
utenti = split(utenti,",")
for i = 0 to uBound(utenti)
id = utenti(i)
sql = "SELECT email FROM account2 WHERE id_account = " & id
set rs = conn.execute(sql)
indirizzoEmail = rs("email")
rs.close
set rs = nothing
strMittente = "info@dominio.it"
strEmailA = indirizzoEmail
objEMail.From = strMittente
objEMail.To = strEmailA
objEMail.Subject = strOggetto
objEMail.BodyFormat = 0
objEMail.MailFormat = 0
objEMail.Body = HTML
objEMail.Send
Set objEMail = Nothing
next
else ' vuol dire che c'è un solo destinatario perchè manca la virgola nella stringa degli id presi con la request
id = utenti
sql = "SELECT email FROM account2 WHERE id_account = " & id
set rs = conn.execute(sql)
indirizzoEmail = rs("email")
rs.close
set rs = nothing
strMittente = "info@dominio.it"
strEmailA = indirizzoEmail
objEMail.From = strMittente
objEMail.To = strEmailA
objEMail.Subject = strOggetto
objEMail.BodyFormat = 0
objEMail.MailFormat = 0
objEMail.Body = HTML
objEMail.Send
Set objEMail = Nothing
end if
Response.Redirect "default2.asp?sez=mailing"
%>
Mi riconfermi che questo:
ti restituisce:codice:response.write Server.MapPath("/images/bg_mail.jpg") response.end
codice:D:\FTP ITGo\miodominio\images\bg_mail.jpg
ho riprovato :
D:\FTP ITGo\eurika\immagini\bg_mail.jpg
(itgo è il maintainer su cui ci appoggiamo)
mi correggo
D:\FTP ITGo\eurika\images\bg_mail.jpg
Prova così:
codice:<%@LANGUAGE="VBSCRIPT"%> <% Function GetPath(FullPath) GetPath = left(FullPath, SplitFileName(FullPath)-1) End Function VirtualFolder = "images" NewFileName = "bg_mail.jpg" virtDestinationPath = "http://" + Request.ServerVariables("SERVER_NAME") + GetPath(Request.ServerVariables("SCRIPT_NAME") ) + VirtualFolder + "/" + NewFileName Dim strMittente Dim strEmailA Dim strOggetto Dim utenti Dim messaggio strOggetto= Request.Form("Oggetto") messaggio=Request.form("Message") utenti=Request.form("checkbox") Set objEMail = Server.CreateObject("CDONTS.NewMail") objEMail.AttachURL virtDestinationPath HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//IT"">" HTML = HTML & "<html>" HTML = HTML & "<head>" HTML = HTML & "<title>prova</title>" HTML = HTML & "</head>" HTML = HTML & "<body background=""images/bg_mail.jpg"">" HTML = HTML &messaggio HTML = HTML & "</body>" HTML = HTML & "</html>" if inStr(utenti," ") > 0 then utenti = replace(utenti," ","") if inStr(utenti,",") > 0 then utenti = split(utenti,",") for i = 0 to uBound(utenti) id = utenti(i) sql = "SELECT email FROM account2 WHERE id_account = " & id set rs = conn.execute(sql) indirizzoEmail = rs("email") rs.close set rs = nothing strMittente = "info@dominio.it" strEmailA = indirizzoEmail objEMail.From = strMittente objEMail.To = strEmailA objEMail.Subject = strOggetto objEMail.BodyFormat = 0 objEMail.MailFormat = 0 objEMail.Body = HTML objEMail.Send Set objEMail = Nothing next else ' vuol dire che c'è un solo destinatario perchè manca la virgola nella stringa degli id presi con la request id = utenti sql = "SELECT email FROM account2 WHERE id_account = " & id set rs = conn.execute(sql) indirizzoEmail = rs("email") rs.close set rs = nothing strMittente = "info@dominio.it" strEmailA = indirizzoEmail objEMail.From = strMittente objEMail.To = strEmailA objEMail.Subject = strOggetto objEMail.BodyFormat = 0 objEMail.MailFormat = 0 objEMail.Body = HTML objEMail.Send Set objEMail = Nothing end if Response.Redirect "default2.asp?sez=mailing" %>
mannaggia mi sa che l'errore è quello di prima:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'SplitFileName'
/admin/mailing.asp, line 7
Alla riga 7 c'è:
GetPath = left(FullPath, SplitFileName(FullPath)-1)
Una cortesia dimenticati per il momento del tuo codice e prova direttamente questo, naturalmente sostituendo ciò che ti interessa:
codice:<% Set objMail = CreateObject("CDONTS.NewMail") ' Allego un file - dal server ovviamente objMail.AttachURL Server.MapPath("/immagini/logo.gif"), "logo.gif" ' HTML = "<HTML><HEAD>" &_ "<title>HTML ed immagini</title>" &_ "</head>" &_ "<body bgcolor=""#FFFFFF"">" &_ " <img src=logo.gif> " &_ "<a href=http://www.quellochetipare.com>" &_ "quellochetipare</a>" &_ " In questo paragrafo..." &_ "</body>" &_ "</html>" ' mittente e destinatario objMail.From = "qualcuno@www.it" objMail.To = "qualcunaltro@www.it" ' subject objMail.Subject = "E-mail con sfondo" ' formato dell'e-mail (HTML) e testo objMail.BodyFormat = 0 objMail.MailFormat = 0 objMail.Body = HTML ' invio objMail.Send() ' distruzione oggetto set objMail = Nothing %>
così l'email arriva con l'immagine, ovviamente non l'ho visualizzata perchè logo.gif non è presente.