제 질문을 검토해 주셔서 감사합니다. 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의 대답으로 끝나는 세미콜론을 사용하는 것을 잊지 마십시오. Old =>'$ to = "someone @ somewhere"'new =>'$ to = "[email protected]"; ' –
@ 무감각 예, 알고 있습니다. Mark B의 anwer는 PHP로 도움이되었지만 아직 메일 기능을 통해 이메일을 보내지는 않습니다. 나는 어쨌든 일어날 것을 기대하지 않았다. postfix가 올바르게 실행되고 있으며 명령 줄에서 메일을 보낼 수 있습니다. 이제는 두 개를 연결해야합니다. –