-1
I E-Mail in codeigniter senden möchten senden, aber wenn ich es folgen Tutorial scheint nicht hier in contact.php meine Funktion send_email()Wie E-Mail in codeigniter
public function send_mail() {
$this->form_validation->set_rules('email', 'Emaid ID', 'trim|required|valid_email');
$this->form_validation->set_rules('product', 'Message', 'trim|required|xss_clean');
//run validation on form input
if ($this->form_validation->run() == FALSE)
{
// redirect("/", "refresh");
}
else
{
// code to send mail
$email = $this->input->post('email');
$product = $this->input->post('product');
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'xxxxx',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->from($email);
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$result = $this->email->send();
if ($result) {
echo "<script type='text/javascript'>alert(Mail send successfully!!!);</script>";
redirect("/", "refresh");
} else {
echo "<script type='text/javascript'>alert(Soemthing when wrong!!!);</script>";
redirect("/", "refresh");
}
}
}
und dies ist mein html funktioniert form
<?php
$attributes = array('class' => 'w3-container w3-margin-bottom');
echo form_open('contact/send_mail', $attributes);
?>
<h3>For buyers:</h3>
<p>
<label>Your email address</label>
<input class="w3-input" type="text" name="email">
</p>
<p>
<label>Products you want to source in Vietnam</label>
<input class="w3-input" type="text" name="product">
</p>
<p><button class="w3-button" style="float: right; border: 1px solid grey" name="submit">Send</button></p>
<?php
echo form_close();
?>
Ich habe Tutorial gelesen, aber es ist nett allgemein. Bitte, also ich, wo ich falsch liege und wie ich es beheben kann.
Haben Sie eine Fehlermeldung? – halojoy
Haben Sie Ihre E-Mail-Einrichtung eingerichtet? – Ice76
Sie müssen genauer über "es funktioniert nicht" Was genau erwarten Sie zu passieren und was genau passiert ist? –