I have a button on a form that will email users tha a new document has been entered into the database. It will send the mail to the users when I hard code there names in the @MailSend. I would like to use a group that I enter on a from that populate column 1 in a view.
I have set up a form that I can input a group that is defined in the databases ACL. That form populates a view called (luDBMGroupEmail) in column 1.
Here is the code for my button:
Users := @DbColumn(“”:“nocache”; “”; “(luDBMGroupEmail)”; 1);
Subject1:="AET Communication ";
Body1:=("Please review the AET communication: " + @NewLine + @NewLine + "Title: " + Subject + @NewLine + @NewLine +"Category: " + Categories + @NewLine + @NewLine + "Region: " + Region_TX + @NewLine + @NewLine + “Note that the updated report may not arrive on your server for a few hours.”);
@MailSend(Users ; "" ; ""; Subject1; ""; Body1; [IncludeDoclink]);
When I click the button i get an error message that states “No names to send mail to”.
What is wrong with my theory or coding?
Subject: @MailSend
Check the variable “Users”
Subject: RE: @MailSend
I set up a test field on y form with the dbcolumn command and it pulls the group I have entered into the (luDBMGroupEmail) view.
Subject: @MailSend
Dis you paste the code in? If so, then the @MailSend Remarks and BodyFields parameters are reversed. Sometimes the error messages are misleading.
Subject: RE: @MailSend
Thia is the same coding that worked when I had the names hard coded in. They were coded in place of the word users
Subject: RE: @MailSend
Stan was saying that just because the error message says the problem is with the sendto argument, doesn’t mean that the error message is correct; it’s lying to you. From the help document for @MailSend:
“When you use the [IncludeDocLink] flag (described below) to include a link to the current document, you should set the bodyFields parameter to null (”“).”
This is a common mistake; the argument names and usage of the @mailSend function are particularly poorly documented, and many (if not most) developers erroneously assume that the BodyFields argument must clearly be the argument to use to set the content of the Body field in the new memo.
Subject: …and of course Stan had already posted the same during my replication cycle.
Subject: RE: @MailSend
Why does the code work with the email addresses hard coded in and with a variable it does not? I am confused.
I have used this format in several db’s and have never had this problem. This is the first time I have tried to send it to a group that is defined in the ACL. Is it different when you try to send it to a group?
Subject: ok, we cross-posted, but
the obvious answer to the question “Why does the code work with the email addresses hard coded in and with a variable it does not?” has to be that the @dbcolumn is failing. You can test that by amending your code to send yourself a message containing the @dbcolumn in the remark argument.
“This is the first time I have tried to send it to a group that is defined in the ACL. Is it different when you try to send it to a group?”
Whether the group appears in the ACL or not is immaterial. And no, there’s no difference between addressing mail to a group or to an individual; as long as an entry matching that value is found in some address book within the scope of the server doing the routing, it’ll get there.
Subject: RE: @MailSend
So what you are saying is that despite the documentation* and someone actually telling you what’s wrong, you aren’t going to switch the two parameters and test it for yourself?
*Syntax
@MailSend
@MailSend( sendTo ; copyTo ; blindCopyTo ; subject ; remark ; bodyFields ; [ flags ] )
Parameters
sendTo
Text or text list. The primary recipient(s) of the mail memo.
copyTo
Text or text list. Optional. The copy recipient(s) of the mail memo.
blindCopyTo
Text or text list. Optional. The blind copy recipient(s) of the mail memo.
subject
Text. Optional. The text you want displayed in the Subject field. This is equivalent to the Subject field on a mail memo; the message is displayed in the Subject column in the views in the recipients’ mail databases.
remark
Text. Optional. Any text you want at the beginning of the body field of the memo.
bodyFields
Text. The names of one or more fields from the current document that you want included in the mail memo. The fields must be of type text or text list, and are appended to the memo in the order in which you list them. (You can store @Text of a numeric field in a variable and use the variable name as a field name.) Enclose each field name in quotation marks. If you want to list multiple fields, use the list format: “description”:“issues”:“resolution.” If you store the name of the field in a variable, omit the quotation marks here.
Subject: RE: @MailSend
No that is not what I am saying. What I was merely saying is that the code I had worked with hard coded email addresses. My reply was not meant to be rude as yours was. While I was waiting for a response I did switch the two around and received the same error.
Subject: RE: @MailSend
“the code I had worked with hard coded email addresses.”
I assume that the word “I” in the above callout is a typo; that you are saying that even with a valid, hard-coded literal email addresses and a “” for the BodyFields argument, you’re still getting this error? eg like this?
@MailSend(“Bruce Fiedler”; “” ; “”; Subject1; Body1; “”; [IncludeDoclink]);
Because if that’s the case, it has to be an address lookup issue.
Subject: RE: @MailSend
Thanks everybody for the posts om my problem. I cut the code out of my button and re pasted the exact code back in and it works now. Not sure as to why. I then switched the Body and Remark fields around and it still works. I left it that way and will continue to code that way.
Thanks again.
Subject: RE: @MailSend
What do you mean “Test Users” ?