$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "email1"
$Mail.Recipients.Add("email2)
$Mail.Subject = "New Request"
$Mail.HTMLBody = " <input type='button' name='approve' value='Submit'/>   <input type='button' name='reject' value='Submit'/> <br/>"
$Mail.HTMLBody += "Kindly approve/reject the request
$Mail.Send()
通过这个脚本,我无法在outlook电子邮件中正确显示按钮。但是当在ie浏览器中打开按钮时效果很好。
我也想知道获得按钮后如何使其工作,这样点击它发送的值在名称数据库
我想,当我点击任何这些按钮的Php运行,并在数据库中的表的列得到更新点击按钮。在上面的代码中我应该写什么和在哪里写php和数据库[sql或oracle]脚本
基本上我想有一个批准/拒绝按钮在电子邮件中由Powershell生成的请求,然后响应被发送到数据库。
在数据库中添加数据的Php代码:
<?php
if(isset($_POST['submit']))
{
$connection = @oci_connect("username","password","db_name");
$badge= $_POST['BADGE'];
$_SESSION["badge"]=$badge;
$reason = $_POST['REASON'];
$dateFrom = $_POST['DATEFROM'];
$dateTo = $_POST['DATETO'];
$dd = $_POST['DD'];
$backup = $_POST['BACKUP'];
$employeeName = $_POST['EMPLOYEENAME'];
$daterequested = date("Y/m/d");
$_SESSION['datefrom'] = $dateFrom;
$_SESSION['dateto'] = $dateTo;
$main_query=oci_parse($connection,"INSERT INTO LEAVEINFO(BADGE,EMPLOYEENAME,TOL,DATEFROM,DATETO,DATEREQUESTED,STATUS,COMMENT1,BACKUP,REASON,LEAD) VALUES('$badge','$employeeName','$dd','$dateFrom','$dateTo','$daterequested','pending','','$backup','$reason','pending')");
oci_execute($main_query,OCI_COMMIT_ON_SUCCESS);
?>
尝试以下代码:
$Outlook = New-Object -ComObject Outlook.Application
$Mail = $Outlook.CreateItem(0)
$Mail.To = "Example1@address.com"
$Mail.Recipients.Add("Example2@address.com")
$Mail.Subject = "New Request"
$linkSubmit = "http://www.example.com/"
$linkReject = "http://www.example2.com/"
$html = @"
<table cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="100" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
<a href="$linkSubmit" style="font-size:16px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-decoration: none; line-height:40px; width:100%; display:inline-block"><span style="color: #FFFFFF">Submit</span></a>
</td>
</tr>
</table>
<br/>
<table cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="100" height="40" bgcolor="#000091" style="-webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; color: #ffffff; display: block;">
<a href="$linkReject" style="font-size:16px; font-weight: bold; font-family: Helvetica, Arial, sans-serif; text-decoration: none; line-height:40px; width:100%; display:inline-block"><span style="color: #FFFFFF">Reject</span></a>
</td>
</tr>
</table>
<p>Kindly approve/reject the request</p>
"@
$Mail.HTMLBody = $html
$Mail.Send()
这将给你2个工作按钮,你需要改变这两个($linkSubmit
$linkReject
)变量到你的数据库URL。
提示:使用@
操作符,您可以将HTML
字符串跨越多行,从而很容易看到您在做什么。
裁判:CSS按钮