我现在一直在努力做这项工作,从我的理解,这不是火箭科学......-我的托管服务提供商没有帮助,我在这些论坛上看到和尝试的一切都没有成功。谁能告诉我我的代码有什么问题?我疯了,我错过了什么?我使用$ mail-> SMTPDebug = 1;看看是否有任何错误发生,根本没有任何错误。当我点击发送我的网页时,字面上什么都不做。此时我甚至没有从表格中获取数据。当我点击发送时,我只是想让它发送电子邮件!一旦我开始工作,我就能完成其他一切。任何帮助深表感谢。对不起,如果这是一个新的错误或简单的事情。
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "relay-hosting.secureserver.net"; // SMTP server
$mail->SMTPDebug = 1;
$mail->From = "word@words.com";
$mail->Username = "word@words.com";
$mail->Password = "poopword";
$mail->AddAddress("blablabla@gmail.com");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
<form class="contactForm" action="php/contact.php" method="post" target="_blank">
<div class="contactFormTitle font1">
don't be shy, come along & say hi
</div>
<fieldset class="contactFormDetails">
<input type="text" name="input-name" value="" placeholder="Name" />
<input type="text" name="input-subject" value="" placeholder="E-mail" />
</fieldset>
<fieldset class="contactFormMessage">
<textarea name="input-message" placeholder="Type your message here"></textarea>
</fieldset>
<fieldset class="contactFormButtons">
<input type="submit" value="Send" />
</fieldset>
</form>
答案 0 :(得分:0)
Godaddy终于回应了一些我刚尝试过的代码而且工作正常!最后关于一周的尝试!此代码将发送电子邮件!使用它作为Godaddy PHP电子邮件模板。
<h3>PHP - Sendmail Test Script</h3>
This script tests sending mail using PHP and Sendmail. Choose your to and from address, and the number of emails you wish you send. This can test how quickly email is being send from the shared hosting server.<br />
<FORM METHOD=GET ACTION="sendmail.php">
To:<br />
<INPUT TYPE="text" NAME="to"><br />
From: <br />
<INPUT TYPE="text" NAME="from"><br>
how many emails?<br />
<INPUT TYPE="text" NAME="loops" VALUE="1"><br />
<INPUT TYPE="submit">
</FORM>
<?
$now = date("D M j G:i:s T Y");
$emailCount = $_GET['loops'];
$toAddress = $_GET['to'];
$from = $_GET['to'];
$fromAddress = "From: $from\r\n" .
"Reply-To: webmaster@" . $_SERVER['SERVER_NAME'] . "\r\n" .
"X-Mailer: PHP/" . phpversion();
if ($toAddress <> ""){
for ($i = 1; $i <= $emailCount; $i++) {
$body = "This test mail was generated on $now";
mail($toAddress, "Test email number $i", $body, $fromAddress);
echo "email number $i sent!<br>";
}
}
?>