Are you storing the message in the database before sending it ?

See inline.

Nuno

Fabio wrote:

Hi folks!

I am working on a method that receives name (ie: John Smith) and email (ie:
[EMAIL PROTECTED]) and sends an email to the given recipient name and email.
The method looks like this:

Method Enviar(pNome As %String, pEmail As %String) As %Status
{
 New Renetente,Msg,TData,sc,Mailer
---------^ (deve ser Remetente)
 If pNome="" Set Remetente=pEmail
 Else  Set Remetente=pNome_"<"_pEmail_">"
 //
 Set Msg = ##class(%Net.MailMessage).%New()
 Set Msg.IsHTML=1
 Set TData=..TextoMalaDireta(pNome)
---------------^
What does this do ?
Is it a CSP ClassMethod ?
If it is, no chances directly on terminal.

 Set sc = Msg.TextData.Write(TData)
 Set Msg.From = Remetente
 Set Msg.Subject = ..Titulo
 Do Msg.To.Insert(pEmail)
 //
 New SMTP
 Set Mailer=##class(%Net.SMTP).%New()
 ;
 &SQL(
 SELECT Valor INTO SMTP
 FROM Sis.Parametros
 WHERE Parametro='MAIL_SMTP_SERVER'
 )
 Set Mailer.smtpserver=SMTP

 If $$$ISOK(sc)
  Quit Mailer.Send(Msg)
 Else  Quit sc
}

I call this method from a CSP and it works fine:

<server>
Set Nome=%request.Get("Nome"),Email=%request.Get("Email")
if $L(Email)>0
{
 Set oEM=##class(EmailMarketing).%OpenId(%request.Get("OBJID"))
 Set sc = oEM.Enviar(Nome,Email)
 if $$$ISOK(sc)
 {
  &JS<
  <script language="JavaScript">
   alert('Email de teste enviado com sucesso!');
  </script>
  >
 }
 Else
 {
  &JS<
  <script language="JavaScript">
   alert('Ocorreu um erro ao enviar o email de teste!');
  </script>
  >
 }
}

</server>

Problem is: when I call this from terminal (ie: do
oEM.Enviar("F�bio","[EMAIL PROTECTED]")) I receive the message but
the body is blank!
Does anybody have any ideas on how to solve this problem?

[]s

F�bio






Reply via email to