0
感謝您花時間審查我的問題。 我在Centos 6.4上設置了postfix我對電子郵件服務器或PHP不是很熟悉,但是我想設置一個簡單的方法來使用postfix發送郵件。我被告知我應該使用PHP。我目前的。 (不工作)的源代碼是...使用php和postfix發送郵件
<!doctype html>
<html>
<head>
<style type="text/css">
#mainContainer
{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
#adressContainer
{
width:100%;
height:3%;
}
#buttonContainer
{
width:100%;
height:5%;
}
#bodyContainer
{
width:100%;
height:90%;
}
#address
{
resize:none;
width:100%;
height:100%;
}
#bodyText
{
resize:none;
width:100%;
height:100%;
}
</style>
<script>
<?php
function sendMail()
{
$to = "[email protected]"
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
}
?>
</script>
<!--<link rel="stylesheet" type="text/css" href="email.css" />-->
</head>
<body>
<div id="mainContainer">
<div id="addressContainer">
<input id="adress" type="text" name="Adress: "></input>
</div>
<div id="buttonContainer">
<button type="submit" onclick="sendMail()">send</button>
</div>
<div id="bodyContainer">
<textarea id="bodyText">I love you whitney :) </textArea>
</div>
</div>
</body>
</html>
郵件服務器很複雜。這種HTML和PHP的混合並沒有告訴我們我們需要知道什麼。 Postfix有很多配置需要正確地完成 –
如果你打算使用一些舊代碼,請記住用Marc B的答案來放置結尾的分號。舊=>'$ to =「someone @ somewhere」'new =>'$ to =「[email protected]」;' –
@relentless是的,我知道。馬克B的anwer幫助我用我的PHP,但我仍然不通過郵件功能發送電子郵件。無論如何我並不期望發生這種情況。我有postfix正確運行,我可以從命令行發送郵件,現在我只需要鏈接這兩個。 –