【发布时间】:2023-03-21 11:41:02
【问题描述】:
我的应用程序中有一个查看候选人表格 ..in 显示所有候选人详细信息,并且我还显示 user_id ..我在视图页面中给出了名为发送的按钮..
所以我正在尝试的是,当我单击按钮时,我需要获取用户电子邮件并将邮件发送给该用户..
查看代码:
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- /.box-header -->
<div class="box-body">
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th></th>
<th>Vendor</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Mobile Number</th>
<th>experience</th>
<th>CTC</th>
<th>Expected Ctc</th>
<th>role</th>
<th>Current Location</th>
<th>Desired Location</th>
<th>Notice Period</th>
<th>Resume</th>
<th>Actions</th>
</tr>
</thead>
<?php
foreach ($view_candidates as $idata)
{
?>
<tbody>
<tr id="domain<?php echo $idata->user_id;?>">
<td class="cell checkbox">
<input type="checkbox" class="selectedId" name="selectedId" />
</td>
<td><?php echo $idata->user_id;?></td>
<td><?php echo $idata->first_name;?></td>
<td><?php echo $idata->last_name;?></td>
<td><?php echo $idata->email;?></td>
<td><?php echo $idata->mobile_number;?></td>
<td><?php echo $idata->experience;?></td>
<td><?php echo $idata->ctc;?></td>
<td><?php echo $idata->expectedctc;?></td>
<td><?php echo $idata->role_name;?></td>
<td><?php echo $idata->current_location;?></td>
<td><?php echo $idata->desired_location;?></td>
<td><?php echo $idata->notice_period;?></td>
<td><?php echo $idata->resume;?></td>
<td><button id="<?php echo $idata->candidate_id; ?>" name="button" onClick="CallFunction(this.id)" class="btn btn-info">send</button></td>
</tr>
<?php
}
?>
</tbody>
控制器:
public function change_status()
{
$candidate_id = $this->input->post('candidate_id');
$this->CandidateModel->update_status($candidate_id);
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => 'test3@clozloop.com',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('test3@clozloop.com', 'bharathi');
$this->email->to('someone@gmail.com');
$this->email->subject('Request for contact info');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin?requirement_id=29">Click Here</a>';
$this->email->message($link);
if($this->email->send())
{
echo "email send";
}
else
{
echo "failed";
}
// echo true;
// exit;
}
型号:
function update_status($candidate_id)
{
$this->db->select('*');
$this->db->from('candidates_details');
$status = $this->db->query("update candidates_details set status='1' where candidate_id ='$candidate_id'");
$data=array('status'=>$status);
$this->db->where('candidate_id',$candidate_id);
//$this->db->update('candidates_details',$data);
//$query=$this->db->get();
echo $this->db->last_query();
//return $query->result();
}
谁能帮助我如何向该用户发送邮件..
提前谢谢..
【问题讨论】:
-
ya..发生的事情是我已经在使用 ajax 调用..同时单击按钮而不刷新任何内容..我将数据库值 0 中的状态更新为 1..
-
我不知道如何获取该用户的电子邮件..请解释一下..如何做到这一点..
-
发布你的 ajax 代码
-
标签: codeigniter email