Eddie Monster
13th January 2006, 22:33
I use a Baan report script to create a unix shell script
#!/usr/bin/ksh
export EMAIL_TO='plantlevel_purchaser@customer.com'
export EMAIL_FROM='batchjob@mycompany.com'
export EMAIL_CC='ar.staff@mycompany.com, production.staff@mycompany.com, production.manager@mycompany.com, invoicing.clerk@mycompany.com, manager_one@customer.com, manager_two@customer.com'
export EMAIL_SUBJECT='Shipments from Oberg Industries, Inc. to Customer'
{
echo To: $EMAIL_TO
echo FROM: $EMAIL_FROM
echo CC: $EMAIL_CC
echo Subject: $EMAIL_SUBJECT
echo 'MIME-Version: 1.0'
echo 'Content-type: text/html'
echo 'Content-Transfer-Encoding: 7bit'
echo '<HTML><HEAD></HEAD><BODY><FONT SIZE=2 FACE="arial">The following items have recently shipped:'
echo ''
echo '<BR><P></P><P></P>'
echo '<TABLE BORDER=1 WIDTH=100%>'
echo '<TR><TD><B><FONT SIZE=2>Customer Reference</B></TD>'
echo '<TD><B><FONT SIZE=2>Item</B></TD>'
echo '<TD><B><FONT SIZE=2>Description</B></TD>'
echo '<TD ALIGN=RIGHT><B><FONT SIZE=2>Ship Date</B></TD>'
echo '<TD ALIGN=RIGHT><B><FONT SIZE=2>Qty Shipped</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Unit</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Qty Received</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>PackSlip</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Invoice</B></TD></TR>'
echo '<TR><TD><FONT SIZE=2>AAAAAAA</TD>'
echo '<TD><FONT SIZE=2>F123-456-54654 </TD>'
echo '<TD><FONT SIZE=2>Part Description</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>1-11-2006</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>80.00</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>tho</TD>'
echo '<TD><FONT COLOR=WHITE SIZE=2>   </TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>233826</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>40058458</TD></TR>'
echo '</FONT></BODY></HTML>'
}|/usr/sbin/sendmail plantlevel_purchaser@customer.com, ar.staff@mycompany.com, production.staff@mycompany.com, production.manager@mycompany.com, invoicing.clerk@mycompany.com, manager_one@customer.com, manager_two@customer.com
I then use the following commands in the Baan report script to close the file, change the files permissions and then execute the file:
ret = seq.close(mail.file)
ret = shell("/${BSE}/common/customer/" & str$(lval(cuno.f)) & "mail",1)
| FOR TESTING... message("Return Value is: " & str$(ret))
If the user runs the session the file is created and the return value for the shell command is zero (successfull execution), but no e-mails are sent. If I then go into the command line and execute the file '3831mail', the e-mails get sent. Can anybody take a guess as to why the emails do not send when the user runs the script?
I chmod the file to 777 just to make sure permissions are not an issue. Our internal email addresses use a dot and the customer's use an underscore, but I wouldn't think that is the problem.
If I change the script to simply send it to two internal employees it works when I run the session, and it also works for the user, but when we try out the full array of e-mail addresses it doesn't work.
Is there a problem with the length of the sendmail command at the end of my script? I'm new to using sendmail and not very familiar with it.
Any help that anyone can offer would be greatly appreciated!
#!/usr/bin/ksh
export EMAIL_TO='plantlevel_purchaser@customer.com'
export EMAIL_FROM='batchjob@mycompany.com'
export EMAIL_CC='ar.staff@mycompany.com, production.staff@mycompany.com, production.manager@mycompany.com, invoicing.clerk@mycompany.com, manager_one@customer.com, manager_two@customer.com'
export EMAIL_SUBJECT='Shipments from Oberg Industries, Inc. to Customer'
{
echo To: $EMAIL_TO
echo FROM: $EMAIL_FROM
echo CC: $EMAIL_CC
echo Subject: $EMAIL_SUBJECT
echo 'MIME-Version: 1.0'
echo 'Content-type: text/html'
echo 'Content-Transfer-Encoding: 7bit'
echo '<HTML><HEAD></HEAD><BODY><FONT SIZE=2 FACE="arial">The following items have recently shipped:'
echo ''
echo '<BR><P></P><P></P>'
echo '<TABLE BORDER=1 WIDTH=100%>'
echo '<TR><TD><B><FONT SIZE=2>Customer Reference</B></TD>'
echo '<TD><B><FONT SIZE=2>Item</B></TD>'
echo '<TD><B><FONT SIZE=2>Description</B></TD>'
echo '<TD ALIGN=RIGHT><B><FONT SIZE=2>Ship Date</B></TD>'
echo '<TD ALIGN=RIGHT><B><FONT SIZE=2>Qty Shipped</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Unit</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Qty Received</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>PackSlip</B></TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE = 2><B>Invoice</B></TD></TR>'
echo '<TR><TD><FONT SIZE=2>AAAAAAA</TD>'
echo '<TD><FONT SIZE=2>F123-456-54654 </TD>'
echo '<TD><FONT SIZE=2>Part Description</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>1-11-2006</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>80.00</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>tho</TD>'
echo '<TD><FONT COLOR=WHITE SIZE=2>   </TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>233826</TD>'
echo '<TD ALIGN=RIGHT><FONT SIZE=2>40058458</TD></TR>'
echo '</FONT></BODY></HTML>'
}|/usr/sbin/sendmail plantlevel_purchaser@customer.com, ar.staff@mycompany.com, production.staff@mycompany.com, production.manager@mycompany.com, invoicing.clerk@mycompany.com, manager_one@customer.com, manager_two@customer.com
I then use the following commands in the Baan report script to close the file, change the files permissions and then execute the file:
ret = seq.close(mail.file)
ret = shell("/${BSE}/common/customer/" & str$(lval(cuno.f)) & "mail",1)
| FOR TESTING... message("Return Value is: " & str$(ret))
If the user runs the session the file is created and the return value for the shell command is zero (successfull execution), but no e-mails are sent. If I then go into the command line and execute the file '3831mail', the e-mails get sent. Can anybody take a guess as to why the emails do not send when the user runs the script?
I chmod the file to 777 just to make sure permissions are not an issue. Our internal email addresses use a dot and the customer's use an underscore, but I wouldn't think that is the problem.
If I change the script to simply send it to two internal employees it works when I run the session, and it also works for the user, but when we try out the full array of e-mail addresses it doesn't work.
Is there a problem with the length of the sendmail command at the end of my script? I'm new to using sendmail and not very familiar with it.
Any help that anyone can offer would be greatly appreciated!