1

how to send email with attachment file. for example I tried attaching the template

$arr['email']="Email send successfully";

                 $this->email->from("Info@.com","example@gmail.com");
                 $this->email->to(set_value("email")); 
                 $this->email->subject("Registration completed");
                 $this->email->message("Your Registration Is Completed");
                 $this->email->send(); 
                 echo "<script> alert('Your Registration successfully');</script>";

            }
shavindip
  • 607
  • 9
  • 27
  • Possible duplicate of [Codeigniter send email with attach file](https://stackoverflow.com/questions/25416585/codeigniter-send-email-with-attach-file) – Jonnix Oct 25 '18 at 13:07

5 Answers5

1

Enables you to send an attachment. Put the file path/name in the first parameter. For multiple attachments use the method multiple times. For example:

$this->email->attach('/path/to/photo1.jpg');
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');

To use the default disposition (attachment), leave the second parameter blank, otherwise use a custom disposition:

$this->email->attach('img.jpg', 'inline');

You can also use a URL:

$this->email->attach('http://example.com/filename.pdf');

If you’d like to use a custom file name, you can use the third parameter:

$this->email->attach('filename.pdf', 'attachment', 'file.pdf');

If you need to use a buffer string instead of a real - physical - file you can use the first parameter as buffer, the third parameter as file name and the fourth parameter as mime-type:

$this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
shavindip
  • 607
  • 9
  • 27
0

https://www.codeigniter.com/user_guide/libraries/email.html

You can follow official site of codeigniter.

Rajeev Prasad
  • 31
  • 1
  • 3
0

Please refer this, https://www.codeigniter.com/user_guide/libraries/email.html

Kindly follow Emailing section below on same page.

WC2
  • 317
  • 1
  • 9
0

Check Out Codeigniter Official Doc For Sending Attachments With Email. Send Email With Attachments

Asif Thebepotra
  • 300
  • 3
  • 10
0

Use $this->email->attach('path_to_your_file'); with your code combination. It will work.

engrhussainahmad
  • 1,008
  • 10
  • 19