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;
$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
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.
add a comment |
$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
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
add a comment |
$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
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
magento-1.9
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.
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
add a comment |
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
add a comment |
2 Answers
2
active
oldest
votes
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');
add a comment |
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');
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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');
add a comment |
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');
add a comment |
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');
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');
answered Jun 18 at 12:38
Rk RathodRk Rathod
2,4163 silver badges17 bronze badges
2,4163 silver badges17 bronze badges
add a comment |
add a comment |
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');
add a comment |
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');
add a comment |
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');
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');
answered Jun 18 at 12:52
surbhi agrsurbhi agr
61616 bronze badges
61616 bronze badges
add a comment |
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You can refer to this magento.stackexchange.com/a/9662/72475 This is using Zend mail
– Smita Kagwade
Jun 18 at 13:24