0
I need a help, I am developing a mailing system that allows sending to a set of email belonging to a group, I managed to do a part now, my txt_para field should receive the name of any group and within this group, I need to make my ASP read the emails that are part of this group and the whole group receive this same email, first follow the Tables involved:
Code of the sent page_Email.Asp that receives the data from the previous form, it sends to an email mass, for example [email protected], [email protected], but I’m not getting to a group for example:
If request("btEnviar") = "Enviar" Then
'Requests
v_id_Email_Remet = request("txtidEmailRem")
Sql_Id = "SELECT" & _
" Id_Email" & _
", Email_Endereco" & _
" FROM" & _
" Email" & _
" WHERE" & _
" Id_Email = '" & v_id_Email_Remet & "'"
Set rsDados = Cn.Execute(Sql_Id)
if rsDados.eof Then
Response.Redirect caminhoASP & "mensagem.asp?msg=" & err.Description
else
v_Email_Remet = rsDados("Email_Endereco")
End If
v_Assunto = request("txtAssunto")
v_Destinatario = trim(request("txtPara"))
v_Copia = request("txtCopia")
v_Template = request("slc_template")
v_Mensagem = request("txtarea_Mensagem")
v_ModeloEnvio = request("rad_ModeloEnvio")
Response.Write "Destinatario: " & v_Destinatario & "<br>"
v_Corpo = "Email enviado de: " & v_Email_Remet & " Para " & v_Destinatario & ", " & " Assunto: " & v_Assunto & " , " & " Mensagem: " & v_Mensagem
'Response.Write ("<b> Id</b> " & v_Email_Remet & "<b> Assunto</b> " & v_Assunto & "<b> Para</b> " & v_Destinatario & "<b> Copia</b> " & v_Copia & "<b> Template</b> " & v_Template & "<b> Mensagem</b> " & v_Mensagem & "<b> Modelo</b> " & v_ModeloEnvio)
'Response.End
arr_email = split(v_Destinatario, ",")
for i = 0 to UBound(arr_email)
if InStr(1,arr_email(i),"@") > 1 then
v_Cdosys = EnviaEmail_CDOSYS (v_Email_Remet,arr_email(i),v_Assunto,v_Corpo,"")
if v_Cdosys = 0 then
v_msgMensagem = "E-mail enviado com sucesso."
v_MostraInfo = v_msgMensagem
end if
else
grupo_id = " SELECT " & _
" Id_Grupo" & _
" FROM Grupo" & _
" WHERE" & _
" Grupo_Nome = '" & arr_email(i) & "'"
Call AbreRS(grupo_id)
While Not Rs.EOF
v_IdGrupo = Rs("Id_Grupo")
Rs.MoveNext
Wend
Call FechaRS
Response.Write "Primeira parte Id Grupo " & v_IdGrupo & "<br>"
if IsNumeric(v_IdGrupo) then
arr_grupoemail = " SELECT " & _
" b.Email_Endereco " & _
" FROM Grupo_Email a " & _
" INNER JOIN Email b ON a.Id_Email = b.Id_Email " & _
" WHERE " & _
" a.Id_Grupo = '" & v_IdGrupo & "'"
Response.Write "Query " & arr_grupoemail & "<br>"
Call AbreRS(arr_grupoemail)
While Not Rs.EOF
'array_GrupoEmail = array_GrupoEmail & "," & Rs("Email_Endereco")
array_GrupoEmail = array_GrupoEmail & Rs("Email_Endereco")
Rs.MoveNext
Wend
Call FechaRS
'limpa = replace(array_GrupoEmail,",","")
Response.Write "Valores " & array_GrupoEmail
item = split(array_GrupoEmail, ",")
Response.Write "Final " & item
'Response.End()
for j = 0 to UBound(item)
v_Cdosys = EnviaEmail_CDOSYS (v_Email_Remet,item(j),v_Assunto,v_Corpo,"")
if v_Cdosys = 0 then
v_msgMensagem = "E-mail enviado com sucesso."
v_MostraInfo = v_msgMensagem
end if
next
else
v_msgMensagem = "Não é um grupo"
v_MostraInfo = v_msgMensagem
end if
end if
next
End If
The error that persists is below in the return request:
Addressee: Development First part Id Group 1 Query SELECT b. Email_addressfrom Grupo_email a INNER JOIN Email b ON a.Id_email = b. Id_email WHERE a.Id_group = '1' Values [email protected]@dominio.com
Microsoft Vbscript Runtime error '800a000d'
Type Mismatch
/Iom/Sistemas/Mailing/ASP/envia_Email.Asp, line 121
In this line of response.write
after the split
:
item = split(array_GrupoEmail, ",")
Response.Write "Final " & item
I don’t know much to do to make it send, I’d like the help of you, thank you
the first thing to do is debug that line, from a Response.write item and responds.end. See if there’s a quote that’s breaking the code
– aa_sp