发送电子邮件来自godaddy帐户

时间:2017-04-25 09:10:11

标签: php email

  

我在用户成功注册后开发了一个php注册页面,他将从我的域名收到谢谢你的邮件   但我尝试用这个PHP代码电子邮件不发送    Php脚本

    $reg_query = mysqli_query($conn, "INSERT INTO `at_reg_user`(`fname`, `lname`, `email`, `password`, `mobile`, `class`, `ipaddress`) VALUES ('$fname','$lname','$email','$password1','$mobile','$class','$remote')");

        if ($reg_query) {

            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->Host = "mail.aenugulakarthik.in";
            $mail->SMTPAuth = true;
            $mail->Username = "karthik@aenugulakarthik.in";
            $mail->Password = "xxxxxxx";
            $mail->From = "karthik@aenugulakarthik.in";
            $mail->FromName = "KarthikAenugula";
            $mail->AddAddress($email);
            $mail->AddReplyTo("karthik@aenugulakarthik.in");
            $mail->WordWrap = 50;
            $mail->IsHTML(true);
            $mail->Subject = "Here is the subject";
            $mail->Body    = "This is the HTML message body <b>in bold!</b>";
            $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

            if ($mail->send())
            {
                echo("<SCRIPT LANGUAGE='JavaScript'>
                      window.alert(' Registration Successful')
                      </SCRIPT>");

            } else {

                echo("<SCRIPT LANGUAGE='JavaScript'>
                      window.alert(' Mail unsent')
                      </SCRIPT>");
            }

1 个答案:

答案 0 :(得分:0)

此处,

$reg_query = mysqli_query($conn, "INSERT INTO `at_reg_user`(`fname`, `lname`, `email`, `password`, `mobile`, `class`, `ipaddress`) VALUES ('$fname','$lname','$email','$password1','$mobile','$class','$remote')");

    if ($reg_query) {

        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->Host = "mail.aenugulakarthik.in";
        $mail->SMTPAuth = true;
        $mail->Username = "karthik@aenugulakarthik.in";
        $mail->Password = "xxxxxxx";
        $mail->From = "karthik@aenugulakarthik.in";
        $mail->FromName = "KarthikAenugula";
        $mail->AddAddress($email);
        $mail->AddReplyTo("karthik@aenugulakarthik.in");
        $mail->WordWrap = 50;
        $mail->IsHTML(true);
        $mail->Subject = "Here is the subject";
        $mail->Body    = "This is the HTML message body <b>in bold!</b>";
        $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

        if ($mail->send())
        {
            echo("<SCRIPT LANGUAGE='JavaScript'>
                  window.alert(' Registration Successful')
                  </SCRIPT>");

        } else {

            echo("<SCRIPT LANGUAGE='JavaScript'>
                  window.alert(' Mail unsent')
                  </SCRIPT>");
        }

你需要拥有godaddy的主机名。像

sg2plcpnlXXXX.prod.sin2.secureserver.net

<domain.com/cpanel>

重定向后,您可以获得该广告