How to send attachments in magento 1.9 mail?Magento : send file attachements in EmailsMagento Unable to send mailSend mail after place orderSend Invoice mail to customerHow to send product images through mailmagento new order send mail not work in 1.9Magento send order conformation mail not send to customermagento 1.9.2.4 blank page when send mailSend attachments via emailmagento Error on mail send

Procedurally generate regions on island

The Confused Alien

Why does a brace command group need spaces after the opening brace in POSIX Shell Grammar?

What is the consensus on handling pagination in 2019 on big result sets?

"Plugged in" or "Plugged in in"

Is it allowed to spend a night in the first entry country before moving to the main destination?

Can the passive "être + verbe" sometimes mean the past?

What is the difference between handcrafted and learned features

What is the art of designing names?

How to solve Keil compiler 'Error: L6218E: Undefined symbol' on STM32

Other than an exponent greater than 1, what are the considerations when creating a random 256-bit private key using Diffie Hellman?

Why won't the ground take my seed?

In native German words, is Q always followed by U, as in English?

Can a US President have someone sent to prison?

Can you sign using a digital signature itself?

How can I get edges to bend to avoid crossing?

What does grep -v "grep" mean and do?

Was it really unprofessional of me to leave without asking for a raise first?

Java Optional working of orElse is not as if else

What is the difference between x RadToDeg cos x div and COSC?

Sum of Parts of An Array - JavaScript

Why are there so many religions and gods?

Who gets an Apparition licence?

Does “comme on était à New York” mean “since” or “as though”?



How to send attachments in magento 1.9 mail?


Magento : send file attachements in EmailsMagento Unable to send mailSend mail after place orderSend Invoice mail to customerHow to send product images through mailmagento new order send mail not work in 1.9Magento send order conformation mail not send to customermagento 1.9.2.4 blank page when send mailSend attachments via emailmagento Error on mail send






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















 $name = $post["name"];
$email = $post["email"];
$address_line_1 = $post["address"];
$attachment = $post["attachment"];
$body = "";

$to = "abc@gmail.com";
$subject = "Career Inquiry";
$body .= "<p>New Career Inquiry.</p>";
$body .= "<p>Name : " . $name . "<p>";
$body .= "<p>Email : " . $email . "<p>";
$body .= "<p>Address Line 1 : " . $address_line_1 . "<p>";
//$body .= "<p>Address Line 2 : " . $address_line_2 . "<p>";
//$body .= "<p>Address Line 3 : " . $address_line_3 . "<p>";
//$body .= "<p>City : " . $city . "<p>";
//$body .= "<p>Post Code : " . $postcode . "<p>";
//$body .= "<p>Country : " . $country . "<p>";

$body .= "<p>Kind regards,</p><p>example Admin</p>";

$from = $email;

$mail = Mage::getModel('core/email');
$mail->setToName('Pranav');
$mail->setToEmail($to);
$mail->setBody($body);
$mail->setSubject($subject);
$mail->setFromEmail($from);
$mail->setFromName($name); //Set from name
$mail->setType('html');// YOu can use Html or text as Mail format
//$mail->setBodyHTML($body); // your content or message

//add attachment start
$base_path = Mage::getBaseDir('base');
$uploadfile = $base_path."media\resume\" . basename($_FILES['attachment']['name']);
$filename =$_FILES['attachment']['name'];
move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile);
$mail->addAttachment($uploadfile, $filename);
//add attachment end

$mail->send();

Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
$this->_redirect('*/*/');
return;









share|improve this question







New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

    – Smita Kagwade
    Jun 18 at 13:24

















0















 $name = $post["name"];
$email = $post["email"];
$address_line_1 = $post["address"];
$attachment = $post["attachment"];
$body = "";

$to = "abc@gmail.com";
$subject = "Career Inquiry";
$body .= "<p>New Career Inquiry.</p>";
$body .= "<p>Name : " . $name . "<p>";
$body .= "<p>Email : " . $email . "<p>";
$body .= "<p>Address Line 1 : " . $address_line_1 . "<p>";
//$body .= "<p>Address Line 2 : " . $address_line_2 . "<p>";
//$body .= "<p>Address Line 3 : " . $address_line_3 . "<p>";
//$body .= "<p>City : " . $city . "<p>";
//$body .= "<p>Post Code : " . $postcode . "<p>";
//$body .= "<p>Country : " . $country . "<p>";

$body .= "<p>Kind regards,</p><p>example Admin</p>";

$from = $email;

$mail = Mage::getModel('core/email');
$mail->setToName('Pranav');
$mail->setToEmail($to);
$mail->setBody($body);
$mail->setSubject($subject);
$mail->setFromEmail($from);
$mail->setFromName($name); //Set from name
$mail->setType('html');// YOu can use Html or text as Mail format
//$mail->setBodyHTML($body); // your content or message

//add attachment start
$base_path = Mage::getBaseDir('base');
$uploadfile = $base_path."media\resume\" . basename($_FILES['attachment']['name']);
$filename =$_FILES['attachment']['name'];
move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile);
$mail->addAttachment($uploadfile, $filename);
//add attachment end

$mail->send();

Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
$this->_redirect('*/*/');
return;









share|improve this question







New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

    – Smita Kagwade
    Jun 18 at 13:24













0












0








0








 $name = $post["name"];
$email = $post["email"];
$address_line_1 = $post["address"];
$attachment = $post["attachment"];
$body = "";

$to = "abc@gmail.com";
$subject = "Career Inquiry";
$body .= "<p>New Career Inquiry.</p>";
$body .= "<p>Name : " . $name . "<p>";
$body .= "<p>Email : " . $email . "<p>";
$body .= "<p>Address Line 1 : " . $address_line_1 . "<p>";
//$body .= "<p>Address Line 2 : " . $address_line_2 . "<p>";
//$body .= "<p>Address Line 3 : " . $address_line_3 . "<p>";
//$body .= "<p>City : " . $city . "<p>";
//$body .= "<p>Post Code : " . $postcode . "<p>";
//$body .= "<p>Country : " . $country . "<p>";

$body .= "<p>Kind regards,</p><p>example Admin</p>";

$from = $email;

$mail = Mage::getModel('core/email');
$mail->setToName('Pranav');
$mail->setToEmail($to);
$mail->setBody($body);
$mail->setSubject($subject);
$mail->setFromEmail($from);
$mail->setFromName($name); //Set from name
$mail->setType('html');// YOu can use Html or text as Mail format
//$mail->setBodyHTML($body); // your content or message

//add attachment start
$base_path = Mage::getBaseDir('base');
$uploadfile = $base_path."media\resume\" . basename($_FILES['attachment']['name']);
$filename =$_FILES['attachment']['name'];
move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile);
$mail->addAttachment($uploadfile, $filename);
//add attachment end

$mail->send();

Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
$this->_redirect('*/*/');
return;









share|improve this question







New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











 $name = $post["name"];
$email = $post["email"];
$address_line_1 = $post["address"];
$attachment = $post["attachment"];
$body = "";

$to = "abc@gmail.com";
$subject = "Career Inquiry";
$body .= "<p>New Career Inquiry.</p>";
$body .= "<p>Name : " . $name . "<p>";
$body .= "<p>Email : " . $email . "<p>";
$body .= "<p>Address Line 1 : " . $address_line_1 . "<p>";
//$body .= "<p>Address Line 2 : " . $address_line_2 . "<p>";
//$body .= "<p>Address Line 3 : " . $address_line_3 . "<p>";
//$body .= "<p>City : " . $city . "<p>";
//$body .= "<p>Post Code : " . $postcode . "<p>";
//$body .= "<p>Country : " . $country . "<p>";

$body .= "<p>Kind regards,</p><p>example Admin</p>";

$from = $email;

$mail = Mage::getModel('core/email');
$mail->setToName('Pranav');
$mail->setToEmail($to);
$mail->setBody($body);
$mail->setSubject($subject);
$mail->setFromEmail($from);
$mail->setFromName($name); //Set from name
$mail->setType('html');// YOu can use Html or text as Mail format
//$mail->setBodyHTML($body); // your content or message

//add attachment start
$base_path = Mage::getBaseDir('base');
$uploadfile = $base_path."media\resume\" . basename($_FILES['attachment']['name']);
$filename =$_FILES['attachment']['name'];
move_uploaded_file($_FILES['attachment']['tmp_name'], $uploadfile);
$mail->addAttachment($uploadfile, $filename);
//add attachment end

$mail->send();

Mage::getSingleton('core/session')->addSuccess('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.');
$this->_redirect('*/*/');
return;






magento-1.9






share|improve this question







New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question







New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question






New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked Jun 18 at 12:36









Pranav PatelPranav Patel

62 bronze badges




62 bronze badges




New contributor



Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




Pranav Patel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.














  • You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

    – Smita Kagwade
    Jun 18 at 13:24

















  • You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

    – Smita Kagwade
    Jun 18 at 13:24
















You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

– Smita Kagwade
Jun 18 at 13:24





You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail

– Smita Kagwade
Jun 18 at 13:24










2 Answers
2






active

oldest

votes


















0














Add Attachment :-



$mailTemplate->getMail()->createAttachment(
file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
Zend_Mime::TYPE_OCTETSTREAM,
Zend_Mime::DISPOSITION_ATTACHMENT,
Zend_Mime::ENCODING_BASE64,
'file.pdf'
);
$mailTemplate->send('toemail@email.com','subject','set message');





share|improve this answer






























    0














    You can use this code in phtml or controller to send mail with attached file



    $mailTemplate = Mage::getModel('core/email_template');
    $mailTemplate->setSenderName('Sender Name');
    $mailTemplate->setSenderEmail('sender@sender.email');
    $mailTemplate->setTemplateSubject('Subject Title');
    $mailTemplate->setTemplateText('Body Text');
    // add attachment
    $mailTemplate->getMail()->createAttachment(
    file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
    Zend_Mime::TYPE_OCTETSTREAM,
    Zend_Mime::DISPOSITION_ATTACHMENT,
    Zend_Mime::ENCODING_BASE64,
    'file.pdf'
    );
    $mailTemplate->send('toemail@email.com','subject','set message');





    share|improve this answer

























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "479"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );






      Pranav Patel is a new contributor. Be nice, and check out our Code of Conduct.









      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f278738%2fhow-to-send-attachments-in-magento-1-9-mail%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      0














      Add Attachment :-



      $mailTemplate->getMail()->createAttachment(
      file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
      Zend_Mime::TYPE_OCTETSTREAM,
      Zend_Mime::DISPOSITION_ATTACHMENT,
      Zend_Mime::ENCODING_BASE64,
      'file.pdf'
      );
      $mailTemplate->send('toemail@email.com','subject','set message');





      share|improve this answer



























        0














        Add Attachment :-



        $mailTemplate->getMail()->createAttachment(
        file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
        Zend_Mime::TYPE_OCTETSTREAM,
        Zend_Mime::DISPOSITION_ATTACHMENT,
        Zend_Mime::ENCODING_BASE64,
        'file.pdf'
        );
        $mailTemplate->send('toemail@email.com','subject','set message');





        share|improve this answer

























          0












          0








          0







          Add Attachment :-



          $mailTemplate->getMail()->createAttachment(
          file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
          Zend_Mime::TYPE_OCTETSTREAM,
          Zend_Mime::DISPOSITION_ATTACHMENT,
          Zend_Mime::ENCODING_BASE64,
          'file.pdf'
          );
          $mailTemplate->send('toemail@email.com','subject','set message');





          share|improve this answer













          Add Attachment :-



          $mailTemplate->getMail()->createAttachment(
          file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
          Zend_Mime::TYPE_OCTETSTREAM,
          Zend_Mime::DISPOSITION_ATTACHMENT,
          Zend_Mime::ENCODING_BASE64,
          'file.pdf'
          );
          $mailTemplate->send('toemail@email.com','subject','set message');






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 18 at 12:38









          Rk RathodRk Rathod

          2,4163 silver badges17 bronze badges




          2,4163 silver badges17 bronze badges























              0














              You can use this code in phtml or controller to send mail with attached file



              $mailTemplate = Mage::getModel('core/email_template');
              $mailTemplate->setSenderName('Sender Name');
              $mailTemplate->setSenderEmail('sender@sender.email');
              $mailTemplate->setTemplateSubject('Subject Title');
              $mailTemplate->setTemplateText('Body Text');
              // add attachment
              $mailTemplate->getMail()->createAttachment(
              file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
              Zend_Mime::TYPE_OCTETSTREAM,
              Zend_Mime::DISPOSITION_ATTACHMENT,
              Zend_Mime::ENCODING_BASE64,
              'file.pdf'
              );
              $mailTemplate->send('toemail@email.com','subject','set message');





              share|improve this answer



























                0














                You can use this code in phtml or controller to send mail with attached file



                $mailTemplate = Mage::getModel('core/email_template');
                $mailTemplate->setSenderName('Sender Name');
                $mailTemplate->setSenderEmail('sender@sender.email');
                $mailTemplate->setTemplateSubject('Subject Title');
                $mailTemplate->setTemplateText('Body Text');
                // add attachment
                $mailTemplate->getMail()->createAttachment(
                file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
                Zend_Mime::TYPE_OCTETSTREAM,
                Zend_Mime::DISPOSITION_ATTACHMENT,
                Zend_Mime::ENCODING_BASE64,
                'file.pdf'
                );
                $mailTemplate->send('toemail@email.com','subject','set message');





                share|improve this answer

























                  0












                  0








                  0







                  You can use this code in phtml or controller to send mail with attached file



                  $mailTemplate = Mage::getModel('core/email_template');
                  $mailTemplate->setSenderName('Sender Name');
                  $mailTemplate->setSenderEmail('sender@sender.email');
                  $mailTemplate->setTemplateSubject('Subject Title');
                  $mailTemplate->setTemplateText('Body Text');
                  // add attachment
                  $mailTemplate->getMail()->createAttachment(
                  file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
                  Zend_Mime::TYPE_OCTETSTREAM,
                  Zend_Mime::DISPOSITION_ATTACHMENT,
                  Zend_Mime::ENCODING_BASE64,
                  'file.pdf'
                  );
                  $mailTemplate->send('toemail@email.com','subject','set message');





                  share|improve this answer













                  You can use this code in phtml or controller to send mail with attached file



                  $mailTemplate = Mage::getModel('core/email_template');
                  $mailTemplate->setSenderName('Sender Name');
                  $mailTemplate->setSenderEmail('sender@sender.email');
                  $mailTemplate->setTemplateSubject('Subject Title');
                  $mailTemplate->setTemplateText('Body Text');
                  // add attachment
                  $mailTemplate->getMail()->createAttachment(
                  file_get_contents(Mage::getBaseDir('base') . '/media/file/file.pdf'), //location of file
                  Zend_Mime::TYPE_OCTETSTREAM,
                  Zend_Mime::DISPOSITION_ATTACHMENT,
                  Zend_Mime::ENCODING_BASE64,
                  'file.pdf'
                  );
                  $mailTemplate->send('toemail@email.com','subject','set message');






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jun 18 at 12:52









                  surbhi agrsurbhi agr

                  61616 bronze badges




                  61616 bronze badges




















                      Pranav Patel is a new contributor. Be nice, and check out our Code of Conduct.









                      draft saved

                      draft discarded


















                      Pranav Patel is a new contributor. Be nice, and check out our Code of Conduct.












                      Pranav Patel is a new contributor. Be nice, and check out our Code of Conduct.











                      Pranav Patel is a new contributor. Be nice, and check out our Code of Conduct.














                      Thanks for contributing an answer to Magento Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f278738%2fhow-to-send-attachments-in-magento-1-9-mail%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

                      Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

                      Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림