Hi Al,<br><br>We have different email contents and subject&nbsp; depending in the action that the customer had taken, since our service is a Prepaid card. What I did, was to use an AGI to have this flexibility. After getting the caller id and querying it in the DB, I will then construct the email that will be sent to the&nbsp; customer.
<br><br>[nihonggo-temporary-registration]<br>exten =&gt; readnum,1,Set(REGPHONE=${CALLERIDNUM})<br>exten =&gt; 2,1,AGI(preRegist.agi,${REGPHONE})<br>exten =&gt; 2,2,AGI(sendEMAILnotification.agi,${REGPHONE})<br><br>AGI script..
<br><br>sub mailSend { <br>&nbsp;&nbsp;&nbsp; my ($subj, $body) = @_;
<br>&nbsp;&nbsp;&nbsp; my(@da, @day, @mon, $datetime, $expTO, $mail, $head);
<br>&nbsp;&nbsp;&nbsp; @da = localtime(time);
<br>&nbsp;&nbsp;&nbsp; @day = qw(Sun Mon Tue Wed Thu Fri Sat);
<br>&nbsp;&nbsp;&nbsp; @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
<br>&nbsp;&nbsp;&nbsp; $datetime = sprintf &quot;%s, %02d %s %d %02d:%02d:%02d +0900&quot;,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ($day[$da[6]], $da[3]*1, $mon[$da[4]], $da[5]+1900,
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $da[2]*1, $da[1]*1, $da[0]*1);
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; $body = Jcode-&gt;new($body)-&gt;h2z-&gt;jis;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; $head&nbsp; = &quot;Return-Path: &lt;$m_RETPATH&gt;\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $expTO = join(&quot;,\n&nbsp;&nbsp;&nbsp; &quot;, @m_MAILTO);
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;To: $expTO\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;From: $m_FROM\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;Date: $datetime\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;Content-type: text/plain; charset=iso-2022-jp\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;Subject: $subj\n&quot;;
<br>&nbsp;&nbsp;&nbsp; $head .= &quot;\n&quot;;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; $head = &amp;mimeencode($head);
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; $mail = &quot;$head$body&quot;;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp; if (open (OUT, &quot;|$QIPATH&quot;)) { # qmail-inject 
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $mail =~ s/%/%%/g;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; printf OUT &quot;$mail&quot;;
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; close (OUT);
<br>&nbsp;&nbsp;&nbsp; }
<br>}<br><br>Hope that helps.<br><br>Best Regards,<br>Joanna<br><a href="http://www.mariazeta.com">www.mariazeta.com</a><br><br><br><br><br><br>