2013-09-25 93 views
1

我嘗試使用Codeigniter向用戶發送確認註冊電子郵件。我需要發送驗證鏈接,但它在協議之前有點標記問題,例如.com。我試圖刪除點號「」之前com它工作正常。請參閱我的代碼下面的代碼:Codeigniter發送電子郵件消息鏈接不起作用

$config['mailtype'] = 'html'; 
$config['protocol'] = 'sendmail'; 
$config['mailpath'] = '/usr/sbin/sendmail'; 
$config['charset'] = 'utf-8'; 
$config['wordwrap'] = TRUE; 
$this->email->initialize($config); 

$this->email->to($email); 
$this->email->from('[email protected]'); 
$this->email->subject('Mail Confirm'); 
$message = "<p>Thanks for registration and you have successfuly register.</p>"; 
$message .= "<p>Please click link here to confirm your registration.</p>"; 
       //Here is my problem 
$message .= "<a href='http://www.mywebsite.com/job_pages/active?code=".$code."' >test</a>"; 

$this->email->message($message); 
+0

什麼問題?日誌說什麼?當email-> print_debugger()失敗時,輸出是什麼?參見[如何以智能的方式提問](http://www.catb.org/esr/faqs/smart-questions.html) – Lepidosteus

回答

0

不應該是你包含的代碼中的問題,你可以包含更多的代碼嗎?

我認爲你必須提出:

$this->email->send(); 
echo $this->email->print_debugger(); 

$this->email->message($message);行之後,如果你說,這是以前的工作?

2

可能是您的鏈接被郵件服務器安全阻止,從您的目標電子郵件。我看過你的代碼。我認爲沒有錯。你是否試圖嵌入像Facebook或Twitter的驗證網站來檢查你的代碼。祝你好運兄弟!

<?php 
    $message .= "<a href='http://www.mywebsite.com/job_pages active?code=".$code."'> 
    test</a>"; 
    //just to check change it to 
    $message .="<a href='https://www.facebook.com'>test</a>"; 
    ?> 

您想在http://tiny.cc/上創建鏈接別名。只需輸入您的網址,然後獲取您的網頁別名。可能是你必須在你的ci配置上配置你的路由文件,以自定義效果。我已經嘗試過,它的工作原理。

相關問題