如何在codigniter中解决这个问题,调用未定义的方法ci_email :: addattachment() [英] How to solve this issue in codigniter,call to undefined method ci_email::addattachment()

查看:113
本文介绍了如何在codigniter中解决这个问题,调用未定义的方法ci_email :: addattachment()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

function attachemant2()
	{

		$data = array(
		array("First Name" => "Nitya", "Last Name" => "Maity", "Email" => "nityamaity87@gmail.com", "Message" => "Test message by Nitya"),
		array("First Name" => "Codex", "Last Name" => "World", "Email" => "info@codexworld.com", "Message" => "Test message by CodexWorld"),
		array("First Name" => "John", "Last Name" => "Thomas", "Email" => "john@gmail.com", "Message" => "Test message by John"),
		array("First Name" => "Michael", "Last Name" => "Vicktor", "Email" => "michael@gmail.com", "Message" => "Test message by Michael"),
		array("First Name" => "Sarah", "Last Name" => "David", "Email" => "sarah@gmail.com", "Message" => "Test message by Sarah")
		);
		// file name for download
		$fileName = "codexworld_export_data" . date('Ymd') . ".xls";

		// headers for download
		header("Content-Disposition: attachment; filename=\"$fileName\"");
		header("Content-Type: application/vnd.ms-excel");

		$flag = false;
		foreach($data as $row) {
			if(!$flag) {
				// display column names as first row
				echo implode("\t", array_keys($row)) . "\n";
				$flag = true;
				echo "Swami";

			}
			// filter data
			array_walk($row, 'filterData');
			echo implode("\t", array_values($row)) . "\n";

		}
		$config = Array(
  'protocol' => 'smtp',
  'smtp_host' => 'ssl://smtp.googlemail.com',
  'smtp_port' => 465,
  'smtp_user' => 'vetri776@gmail.com', // change it to yours
  'smtp_pass' => '9578010375', // change it to yours
  'mailtype' => 'html',
  'charset' => 'iso-8859-1',
  'wordwrap' => TRUE
		);

		$this->load->library('email', $config);
		$this->load->library('email', NULL, 'ci_email');
		$this->email->set_newline("\r\n");
		$this->email->from('vetri776@gmail.com'); // change it to yours
		$this->email->to('vetrinature@gmail.com');// change it to yours
		$this->email->subject('Client Details');
		$this->email->message("Hi");
		$this->email->AddAttachment($fileName );
		if($this->email->send())
		{
			echo implode(" ",$data);
		}
		else
		{
			show_error($this->email->print_debugger());
		}
	}





我的尝试:



我试图创建excel文件并附加和发送。但我遇到了这个问题,

如何解决这个问题...



What I have tried:

I have tried to create excel file and attach and send.but i faced this issue,
how to solve this issue...

推荐答案

data = array(
array( 名字 => Nitya 姓氏 => Maity 电子邮件 => nityamaity87@gmail.com 消息 => Nitya测试消息),
数组( 名字 => Codex 姓氏 => World 电子邮件 => info@codexworld.com 消息 => CodexWorld测试消息),
数组( 名字 => John 姓氏 => Thomas 电子邮件 => john@gmail.com 消息 => 由John测试消息),
数组( 名字 => Michael 姓氏 => Vicktor 电子邮件 => michael@gmail.com 消息 => 测试消息由Michael),
数组( 名字 => Sarah 姓氏 => David 电子邮件 => sarah@gmail.com 消息 => Sarah测试消息
);
// 下载文件名
data = array( array("First Name" => "Nitya", "Last Name" => "Maity", "Email" => "nityamaity87@gmail.com", "Message" => "Test message by Nitya"), array("First Name" => "Codex", "Last Name" => "World", "Email" => "info@codexworld.com", "Message" => "Test message by CodexWorld"), array("First Name" => "John", "Last Name" => "Thomas", "Email" => "john@gmail.com", "Message" => "Test message by John"), array("First Name" => "Michael", "Last Name" => "Vicktor", "Email" => "michael@gmail.com", "Message" => "Test message by Michael"), array("First Name" => "Sarah", "Last Name" => "David", "Email" => "sarah@gmail.com", "Message" => "Test message by Sarah") ); // file name for download


fileName = codexworld_export_data 。 date(' Ymd')。 。xls;

// 下载标题
header( Content-Disposition:attachment; filename = \
fileName = "codexworld_export_data" . date('Ymd') . ".xls"; // headers for download header("Content-Disposition: attachment; filename=\"


fileName \< /跨度>);
header( Content-Type:application / vnd.ms-excel);

fileName\""); header("Content-Type: application/vnd.ms-excel");


这篇关于如何在codigniter中解决这个问题,调用未定义的方法ci_email :: addattachment()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆