Não sei o que eu faço para arrumar isso.

Var_Anexo = Request.Form("anexo")
Obj_Email.AddAttachment (Var_Anexo)
Posted 04/05/2007, 14:26
Posted 04/05/2007, 14:40
Posted 04/05/2007, 14:55
Posted 04/05/2007, 15:07
Edição feita por: ellen, 04/05/2007, 15:14.
Posted 04/05/2007, 15:21
Posted 04/05/2007, 17:09
<%
flag = request("flag")
if flag = "" then
flag = 0
end if
function trata_string(str)
str = replace(str,vbCrLf,"<br />")
trata_string = str
end function
if flag then
On Error Resume Next
nome = Request.Form("nome")
telefone = Request.Form("telefone")
email = Request.Form("email")
cidade = Request.Form("cidade")
estado = Request.Form("estado")
mensagem = Request.Form("mensagem")
if email = "" then
email = "seu email"
end if
'Coloque aqui o titulo
titulo = "Contato "
enviou = 0 'nada
e_mail = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR...nal.dtd""><html xmlns=""http://www.w3.org/19...l""><head><meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"" /></head><body>"
e_mail = e_mail &"<font face=""Arial"" size=""2""><h5>" & titulo & " - " & now & "</h5>"
e_mail = e_mail & "<b>Nome: </b> " & nome & " <br>"
e_mail = e_mail & "<b>Telefone:</b> " & telefone & " <br>"
e_mail = e_mail & "<b>E-mail:</b> " & email &" <br>"
e_mail = e_mail & "<b>Cidade/Estado:</b> " & cidade &"/"& estado &" <br>"
e_mail = e_mail & "<b>Mensagem: </b> " & "<br>"
e_mail = e_mail & mensagem & " <br>"
e_mail = e_mail & "____________________________________________________________________________" & "</font><br>"
e_mail = e_mail & "</body></html>"
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
With objCDOSYSCon
.Fields("http://schemas.micro...ion/smtpserver") = "localhost"
.Fields("http://schemas.micro...smtpserverport") = 25
.Fields("http://schemas.micro...tion/sendusing") = 2
.Fields("http://schemas.micro...nectiontimeout") = 30
.Fields.update
End With
Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSMail
.From = email
.To = "seu email"
if session("arquivo") <> "" then
.AddAttachment(Session("Arquivo"))
end if
.Subject = titulo
.HtmlBody = trata_string(e_mail)
.Send
if acao = "upload" then
Session("Arquivo") = ""
end if
End With
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
Set obj_Upload = Nothing
msg = "Contato enviado com sucesso" ' certo
Session("Arquivo") = ""
If Err.number<>0 then
msg = "Ocorreu um erro ao enviar o contato." 'errado
End If
end if
acao = request("acao")
if acao = "" then
acao = "none"
end if
if acao = "upload" then 'caso a acao seja upload, executa script do SaFileUp
Set obj_Upload = Server.CreateObject("SoftArtisans.FileUp")
obj_Upload.Path = Server.MapPath("./upload") 'local onde será gravado o arquivo
if obj_Upload.TotalBytes > 1000000 then
Response.Write "<script>alert('Seu arquivo ultrapassou o limite de 1MB.')</script>"
v_foco = " onLoad=""document.contato.nome.focus();"""
session("arquivo") = ""
else
on error resume next
obj_Upload.Form("File").Save
Session("arquivo") = obj_Upload.Form("File").ServerName 'recupera o nome do arquivo no servidor
if err.number<>0 then
Response.Write "<script>alert('Você deve selecionar um arquivo antes de anexar.')</script>"
session("arquivo") = ""
else
Response.Write "<script>alert('Seu arquivo foi anexado. Por favor, agora preencha o formulário com seus dados!')</script>"
v_foco = " onLoad=""document.contato.nome.focus();""" 'coloca o cursor no campo do form de nome
end if
' Session("Arquivo") = ""
end if
End if
%>
Posted 08/05/2007, 10:45
Olha meu código...
<%
flag = request("flag")
if flag = "" then
flag = 0
end if
function trata_string(str)
str = replace(str,vbCrLf,"<br />")
trata_string = str
end function
if flag then
On Error Resume Next
nome = Request.Form("nome")
telefone = Request.Form("telefone")
email = Request.Form("email")
cidade = Request.Form("cidade")
estado = Request.Form("estado")
mensagem = Request.Form("mensagem")
if email = "" then
email = "seu email"
end if
'Coloque aqui o titulo
titulo = "Contato "
enviou = 0 'nada
e_mail = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR...nal.dtd""><html xmlns=""http://www.w3.org/19...l""><head><meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"" /></head><body>"
e_mail = e_mail &"<font face=""Arial"" size=""2""><h5>" & titulo & " - " & now & "</h5>"
e_mail = e_mail & "<b>Nome: </b> " & nome & " <br>"
e_mail = e_mail & "<b>Telefone:</b> " & telefone & " <br>"
e_mail = e_mail & "<b>E-mail:</b> " & email &" <br>"
e_mail = e_mail & "<b>Cidade/Estado:</b> " & cidade &"/"& estado &" <br>"
e_mail = e_mail & "<b>Mensagem: </b> " & "<br>"
e_mail = e_mail & mensagem & " <br>"
e_mail = e_mail & "____________________________________________________________________________" & "</font><br>"
e_mail = e_mail & "</body></html>"
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
With objCDOSYSCon
.Fields("http://schemas.micro...ion/smtpserver") = "localhost"
.Fields("http://schemas.micro...smtpserverport") = 25
.Fields("http://schemas.micro...tion/sendusing") = 2
.Fields("http://schemas.micro...nectiontimeout") = 30
.Fields.update
End With
Set objCDOSYSMail.Configuration = objCDOSYSCon
With objCDOSYSMail
.From = email
.To = "seu email"
if session("arquivo") <> "" then
.AddAttachment(Session("Arquivo"))
end if
.Subject = titulo
.HtmlBody = trata_string(e_mail)
.Send
if acao = "upload" then
Session("Arquivo") = ""
end if
End With
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
Set obj_Upload = Nothing
msg = "Contato enviado com sucesso" ' certo
Session("Arquivo") = ""
If Err.number<>0 then
msg = "Ocorreu um erro ao enviar o contato." 'errado
End If
end if
acao = request("acao")
if acao = "" then
acao = "none"
end if
if acao = "upload" then 'caso a acao seja upload, executa script do SaFileUp
Set obj_Upload = Server.CreateObject("SoftArtisans.FileUp")
obj_Upload.Path = Server.MapPath("./upload") 'local onde será gravado o arquivo
if obj_Upload.TotalBytes > 1000000 then
Response.Write "<script>alert('Seu arquivo ultrapassou o limite de 1MB.')</script>"
v_foco = " onLoad=""document.contato.nome.focus();"""
session("arquivo") = ""
else
on error resume next
obj_Upload.Form("File").Save
Session("arquivo") = obj_Upload.Form("File").ServerName 'recupera o nome do arquivo no servidor
if err.number<>0 then
Response.Write "<script>alert('Você deve selecionar um arquivo antes de anexar.')</script>"
session("arquivo") = ""
else
Response.Write "<script>alert('Seu arquivo foi anexado. Por favor, agora preencha o formulário com seus dados!')</script>"
v_foco = " onLoad=""document.contato.nome.focus();""" 'coloca o cursor no campo do form de nome
end if
' Session("Arquivo") = ""
end if
End if
%>
Qualquer dúvida... me avise...
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)