PDF-Anhang per E-Mail im CodeIgniter Mysource-Code hier
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]');
$this->email->to($useremail);
$this->email->cc('');
$this->email->subject('pdf');
$this->email->message($message);
$this->email->attach('public_html/invoicepdf/171.pdf');
$mailsucc = $this->email->send();
Ich habe es damit versucht, aber es hat nicht funktioniert
$this->email->attach('public_html/invoicepdf/171.pdf');
Und ich ersetze auch Pfad durch URL.
Sie können eine Anhangsdatei mit senden
$this->email->attach($atch);
Methode im Codeigniter. In diesem Code sende ich E-Mails über SMTP mit angehängter Datei.
Es funktioniert perfekt. Sie müssen nur angeben base_url
, um den Pfad der Anhangsdatei zu definieren
Regler
$email_config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.gmail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]', // change it to yours
'smtp_pass' => 'mypasswords', // change it to yours
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
// Defined Attachment file using variable
$atch=base_url().'html/images/logo.png';
$this->load->library('email', $email_config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'Rudra'); // email From
$this->email->to('[email protected]'); // eMail to send
$this->email->subject('Mail with Attachment'); // Subject
$this->email->message("This is mail with Attachment file using CodeIgniter."); // Message
$this->email->attach($atch); // Attachment file defined using variable
$maill=$this->email->send(); // send mail
if($maill>0)
{
echo 'Email sent.'; // success
}
else
{
show_error($this->email->print_debugger());
}
Dieser Artikel stammt aus dem Internet. Bitte geben Sie beim Nachdruck die Quelle an.
Bei Verstößen wenden Sie sich bitte [email protected] Löschen.
Lass mich ein paar Worte sagen