我无法从服务器发送电子邮件


i cant sent email from server.?

在这里,我尝试创建一个从服务器发送电子邮件的进程。。单击"保存/发送"按钮后,总会出现服务器错误500。。任何人都不能帮我修。

<?php
include('../include/dbconn.php');
include('PHPMailer/PHPMailerAutoload.php');
require('PHPMailer/class.PHPMailer.php');
            $to = $_POST['email_to'];
            $subject = $_POST['subject'];
            $message = $_POST['message'];
            $img = $_FILES["img"]["name"];
            $from = "info@internationaltimes.com.my";
            $cc = $_POST['email_cc'];
            $bcc = $_POST['email_bcc'];
            $headers .= "From: $from 'r'n";
            $headers .= "Reply-To: $from 'r'n";
            $headers .= "MIME-Version: 1.0'r'n";
            $headers .= "Content-Type: text/html; charset=ISO-8859-1'r'n";
            //SET EMAIL PRIORITY
            //$headers .= "X-Priority: 1 (Highest)'n";
            $headers .= "X-MSMail-Priority: High'n";
            $headers .= "Importance: High'n";

$add = mysql_query($conn, "INSERT INTO email_sent_inbox set sent_time = now(), sender = '$_POST[username]', mailto = '$_POST[email_to]', cc = '$_POST[email_cc]', bcc = '$_POST[email_bcc]', mail_subject = '$_POST[subject]', message = '$_POST[message]'" or die (mysql_error());
if($add){
    $retval = mail ($to,$subject,$message,$header); 
    if($retval)
    {
        echo "<script>window.location='newsletter_blasting.php';</script>"; 
    }
}
?>

您在getSharedPreferences() 中使用了两个不同的名称

活动一-getSharedPreferences("SharedPreferencesDemo",MODE_PRIVATE)

活动二-getSharedPreferences("SharedPreferences", MODE_PRIVATE);

试着用同样的名字。

点击此处了解更多信息。

删除所有sharedPreference内容。

startActivity(intent)之前的第一个活动中添加以下内容:

intent.putExtra("name", n);
intent.putExtra("id", i);
intent.putExtra("class", c);

在第二个活动中:

Bundle bundle = getIntent().getExtras();
String n = bundle.getString("name");
String i = bundle.getString("id");
String c = bundle.getString("class");