I need a help, I'm developing a mailing system that allows sending to a group of emails belonging to a group, I was able to do a part now, my field txt_to 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 follows the tables involved:
Codeofthepageenvia_Email.aspthatreceivesthedataofthepreviousform,itsendstoamassofemail,[email protected],[email protected],butIamnotgettingforagroupforexample:
Ifrequest("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 the return request:
Target: Development First Part Id Group 1 SELECT Query b.Email_Endereco FROM Group_Email a INNER JOIN Email b ON a.Id_Email = b.Id_Email WHERE a.Id_Group = '1' Values leandro @ domain.comleonardo @ domain.com
Microsoft VBScript runtime error '800a000d'
Type mismatch
/iom/Sistemas/Mailing/ASP/envia_Email.asp, line 121
In this line of response.write
after split
:
item = split(array_GrupoEmail, ",")
Response.Write "Final " & item
I do not know much what to do to send it, I would like the help of you, thank you