Strange sendmail command behaviour ... need workaround !!!

Strange sendmail command behaviour ... need workaround !!!

Hi:

I have this code in the on Click section of a Stateless Form ...
if (EmailTo  ==  null)
{
//send only to admin
sendmail
(
To : zoho.adminuserid
From : zoho.adminuserid
Subject : EmailSubject
Message : EmailMessage
)
}
else
{
//send to admin and provided email
sendmail
(
To : zoho.adminuserid, EmailTo
From : zoho.adminuserid
Subject : EmailSubject
Message : EmailMessage
)
}




















I am doing this so I can send the email to both the AppAdmin and the User ... but if there is no user email, I want to send the email to just the AppAdmin.

I tested various scenarios using ...

myAppAdminAccount@sympatico.ca
myOtherAccount@sympatico.ca
myAccount@yahoo.com

Here are my findings ...

a) If EmailTo is myAccount@yahoo.com, I receive emails at both myAccount@yahoo.com and myAppAdminAccount@sympatico.ca ... behaviour as expected !!!

b)












If EmailTo is myOtherAccount@sympatico.ca, I receive only the one email at myOtherAccount@sympatico.ca

c)

If EmailTo is myAppAdminAccount@sympatico.ca, I do not receive any emails


d) If EmailTo is empty (null), I do not receive any emails


Looks like ...

i) it won't send an email when the To: and From: fields are identical (cases (c) and (d))

ii) it won't send email to the To: account with the same address as the From: address if the other address in the To: field is in the same domain (case  (b))

iii) it will only send email to the To: account with the same address as the From: address if the other To: account is on another domain (case (a))


Can someone at Support please explain this ... and suggest a workaround to the problem.

Your prompt response will be appreciated.



Gaev