2013-09-25 91 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配置上配置你的路由文件,以自定义效果。我已经尝试过,它的工作原理。

相关问题