ปัญหา SMTP server response: 501 5.5.4 Invalid Address in คับ

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
rag2club
PHP Newbie
PHP Newbie
โพสต์: 9
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

ปัญหา SMTP server response: 501 5.5.4 Invalid Address in คับ

โพสต์ที่ยังไม่ได้อ่าน โดย rag2club »

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in D:\home\includes\email.class.php on line 207
แบบระบบไม่สามารถส่งอีเมลด์ได้อ่ะครับ
ผมลอง สคริปส่งเมล์ธรรมดามันก็ใช้ได้ปกติ

ช่วยดู โค๊ดให้หน่อยน่ะครับ

email.class.php
<?php
/*
+--------------------------------------------------------------------------
| Mega File Hosting Script v1.1
| ========================================
| by Stephen Yabziz
| (c) 2005-2006 YABSoft Services
| http://www.yabsoft.com
| ========================================
| Web: http://www.yabsoft.com
| Email: [email protected]
+--------------------------------------------------------------------------
|
| > Script written by Stephen Yabziz
| > Date started: 1th March 2006
+--------------------------------------------------------------------------
*/
/**
* @package MFHS
* Email
*/
define('MAIL_LOW_PRIORITY', 4);
define('MAIL_NORMAL_PRIORITY', 3);
define('MAIL_HIGH_PRIORITY', 2);

class Email
{
var $vars, $msg, $extra_headers, $replyto, $from, $subject, $encoding;
var $addresses = array();

var $mail_priority = MAIL_NORMAL_PRIORITY;
var $html_email = 'test/plain';
var $admin_email = true;
var $tpl_msg = array();

function Email($tpl_dir)
{
$this->template = new Template( $tpl_dir );

$this->template->cache=0;

$this->subject = '';
}
// Resets all the data (address, template file, etc etc) to default
function reset()
{
$this->addresses = array();
$this->vars = $this->msg = $this->extra_headers = $this->replyto = $this->from = $this->encoding = '';
$this->mail_priority = MAIL_NORMAL_PRIORITY;
}

// Sets an email address to send to
function to($address, $realname = '')
{
$pos = isset($this->addresses['to']) ? sizeof($this->addresses['to']) : 0;
$this->addresses['to'][$pos]['email'] = trim($address);
$this->addresses['to'][$pos]['name'] = strpos($address,'<')===false && strpos($address,'>')===false ? trim($realname) : '';
}

function cc($address, $realname = '')
{
$pos = isset($this->addresses['cc']) ? sizeof($this->addresses['cc']) : 0;
$this->addresses['cc'][$pos]['email'] = trim($address);
$this->addresses['cc'][$pos]['name'] = trim($realname);
}

function bcc($address, $realname = '')
{
$pos = isset($this->addresses['bcc']) ? sizeof($this->addresses['bcc']) : 0;
$this->addresses['bcc'][$pos]['email'] = trim($address);
$this->addresses['bcc'][$pos]['name'] = trim($realname);
}

function replyto($address)
{
$this->replyto = trim($address);
}

function from($address)
{
$this->from = trim($address);
}

// set up subject for mail
function subject($subject = '')
{
$this->subject = trim($subject);
}

// set up extra mail headers
function headers($headers)
{
$this->extra_headers .= trim($headers) . "\n";
}

function set_mail_priority($priority = MAIL_NORMAL_PRIORITY)
{
$this->mail_priority = $priority;
}

// Send the mail out to the recipients set previously in var $this->address
function send($handle,$method = NOTIFY_EMAIL)
{
global $LANG;

$this->msg = $this->template->assign_var_from_handle('', $handle,1,1);


// We now try and pull a subject from the email body ... if it exists,
// do this here because the subject may contain a variable
$drop_header = '';
$match = array();
if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match))
{
$this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $LANG['NO_SUBJECT']);
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
}
else
{
$this->subject = (($this->subject != '') ? $this->subject : $LANG['NO_SUBJECT']);
}
if (preg_match('#^(Charset:(.*?))$#m', $this->msg, $match))
{
$this->encoding = (trim($match[2]) != '') ? trim($match[2]) : trim($LANG['charset']);
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
}
else
{
$this->encoding = trim($LANG['charset']);
}
if (preg_match('#^(HtmlEmail:(.*?))$#m', $this->msg, $match))
{
$this->html_email = (trim($match[2]) != '') ? trim($match[2]) : trim($LANG['HtmlEmail']);
$drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
}
else
{
$this->html_email = 'text/plain';
}
if ($drop_header)
{
$this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));
}

$result = $this->msg_email();

$this->reset();
return $result;
}

function error($type, $msg)
{
//echo('critical', 'LOG_ERROR_' ,$type, $msg);
}


function msg_email()
{
$to = $cc = $bcc = '';
// Build to, cc and bcc strings
foreach ($this->addresses as $type => $address_ary)
{
if ($type == 'im')
{
continue;
}

foreach ($address_ary as $which_ary)
{
$$type .= (($$type != '') ? ', ' : '') . (($which_ary['name'] != '') ? '"' . $this->mail_encode($which_ary['name'], $this->encoding) . '" <' . $which_ary['email'] . '>' : $which_ary['email']);
$$type .= (($$type != '') ? ', ' : '') . $which_ary['email']; //(($which_ary['name'] != '') ? '"' . $this->mail_encode($which_ary['name'], $this->encoding) . '" <' . $which_ary['email'] . '>' : $which_ary['email']);
}
}
if (empty($this->replyto))
{
$this->replyto = '<' . $this->admin_email . '>';
}

if (empty($this->from))
{
$this->from = '<' . $this->admin_email . '>';
}

// Build header
$headers = 'From: ' . $this->from . "\n";
$headers .= ($cc != '') ? "Cc: $cc\n" : '';
$headers .= ($bcc != '') ? "Bcc: $bcc\n" : '';
$headers .= 'Reply-to: ' . $this->replyto . "\n";
$headers .= 'Return-Path: <' . $this->admin_email . ">\n";
$headers .= 'Sender: <' . $this->admin_email . ">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= 'Message-ID: <' . md5((time())) . "@" . $_SERVER['HTTP_HOST'] . ">\n";
$headers .= 'Date: ' . gmdate('D, d M Y H:i:s T', time()) . "\n";
$headers .= "Content-type: {$this->html_email}; charset={$this->encoding}\n";
$headers .= "Content-transfer-encoding: 8bit\n";
$headers .= "X-Priority: {$this->mail_priority}\n";
$headers .= 'X-MSMail-Priority: ' . (($this->mail_priority == MAIL_LOW_PRIORITY) ? 'Low' : (($this->mail_priority == MAIL_NORMAL_PRIORITY) ? 'Normal' : 'High')) . "\n";
$headers .= "X-Mailer: MFHS\n";
$headers .= "X-MimeOLE: MFHS\n";
$headers .= ($this->extra_headers != '') ? $this->extra_headers : '';

// Send message ... removed $this->encode() from subject for time being
$mail_to = ($to == '') ? 'Undisclosed-Recipient:;' : $to;
$err_msg = '';

//$result = mail($mail_to, $this->subject, implode("\n", preg_split("/\r?\n/", wordwrap($this->msg))), $headers);
$result = mail($mail_to, $this->subject, implode("\n", preg_split("/\r?\n/", wordwrap($this->msg))), $headers);
//echo $mail_to, $this->subject,$headers;
//print_r($this->addresses);
if (!$result)
{
$message = '<u>EMAIL ERROR</u> [ PHP ]<br /><br />' . $err_msg . '<br /><br /><u>CALLING PAGE</u><br /><br />' . ((!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : $_ENV['PHP_SELF']) . '<br />';
$this->error('EMAIL', $message);
return false;
}
return true;
}
/**
* Encodes the given string for proper display for this encoding ... nabbed
* from php.net and modified. There is an alternative encoding method which
* may produce less output but it's questionable as to its worth in this
* scenario IMO
*/
function mail_encode($str, $encoding)
{
if ($encoding == '')
{
return $str;
}

// define start delimimter, end delimiter and spacer
$end = "?=";
$start = "=?$encoding?B?";
$spacer = "$end\r\n $start";

// determine length of encoded text within chunks and ensure length is even
$length = 75 - strlen($start) - strlen($end);
$length = floor($length / 2) * 2;

// encode the string and split it into chunks with spacers after each chunk
$str = chunk_split(base64_encode($str), $length, $spacer);

// remove trailing spacer and add start and end delimiters
$str = preg_replace('#' . preg_quote($spacer, '#') . '$#', '', $str);

return $start . $str . $end;
}
}
?>
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41123
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

นี่มันเป็น class ต้นแบบนี่ครับ แล้ว เรียกใข้ไป ยังไง ครับ
แต่ที่ error มันบอก น่าจะมาจาก ใส่ parameter ไม่ถูก หรือไม่ ครบ น่ะครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
rag2club
PHP Newbie
PHP Newbie
โพสต์: 9
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

โพสต์ที่ยังไม่ได้อ่าน โดย rag2club »

ถ้าขอติดต่อทาง MSN ได้เปล่าอ่ะครับ

พอดีผมทำเวปอัพโหลด แล้วมันสมัค สมาชิกแต่ส่งเมล์ไปยืนยันไม่ได้อ่ะครับ

ลองดูครับ http://xupfile.ath.cx/index.php

พอดีเช่าเครื่อง Server มา -*-
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41123
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ไม่ได้ เล่น m ครับ มีอะไร คุย ทางนี้ ได้ เข้ามาบ่อย...
-------------------------------------
เรียกใช้ class นั้นไป ยังไง ครับ
----------------------------
ลอง เอาโค้ดมาดูได้มั๊ยครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
rag2club
PHP Newbie
PHP Newbie
โพสต์: 9
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

โพสต์ที่ยังไม่ได้อ่าน โดย rag2club »

http://61.47.61.109/mfhs-1.2.zip

ลองเอาไปติดตั้งดูครับ
ต้องใช้ Perl + Zend ด้วยน่ะครับ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41123
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ให้ มาทั้งหมด เลยหรือครับ ขอแค่ที่มีปัญหา พอครับ ไม่ว่างพอที่จะดู ทั้งระบบ ง่ะครับ
เขียน ส่วน ที่มีปัญหายังไง ก็พอครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
rag2club
PHP Newbie
PHP Newbie
โพสต์: 9
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

โพสต์ที่ยังไม่ได้อ่าน โดย rag2club »

ลองโหลดไปดูครับ
ไฟล์ที่มีปัณหาจะอยู่ที่
includes\email.class.php
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41123
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ไฟล์ ที่มีปัญหา ไม่ใช่ไฟล์ includes\email.class.php หรอก ครับ
มีปัญหา ตอนเรียกใช้ Class ลองเช็ค ดูว่า ตรงไหน ไปเรียกใช้ Class นั่น
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
rag2club
PHP Newbie
PHP Newbie
โพสต์: 9
ลงทะเบียนเมื่อ: 01/01/1970 7:00 am

โพสต์ที่ยังไม่ได้อ่าน โดย rag2club »

ผมก็ไม่ค่อยเก่งอ่ะครับ ไม่รู้เหมือนกัน
แต่ Mail Server ผมก็ติดตั้งไปแล้วส่งได้ปกติ
ลองโหลดไปทดสอบดูดีกว่า -*-

งิงิ หาคนช่วยม่ายล้ายเยย
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41123
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

คงไม่เกี่ยว กับ Mail Server ล่ะครับ ถ้า เกี่ยวกับ mail Server จะเป็น error แบบ อื่น
ส่วนโค้ด เขียนไป ยังไง คงต้อง ดู มาเอง ล่ะครับ ว่าเขียน และ เรียกใช้ มัน ยังไง
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 60