为什么不使用此代码发送电子邮件?洋红色
Why is the email is not send in this code? Magento
当用户填写表单并单击 submit.I 我正在尝试为用户发送电子邮件 submit.I 在 Magento 中创建了一个控制器并包含以下代码
public function sendMailAction(){
$html="put your html content hereblah blah";
$mail = Mage::getModel('core/email');
$mail->setToName('Your Name');
$mail->setToEmail('sadeeenadeee@gmail.com');
$mail->setBody('Mail Text / Mail Content');
$mail->setSubject('Mail Subject');
$mail->setFromEmail('Sender Mail Id');
$mail->setFromName("Msg to Show on Subject");
$mail->setType('html');// YOu can use Html or text as Mail format
try {
$mail->send();
Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
$this->_redirect('');
}
catch (Exception $e) {
Mage::getSingleton('core/session')->addError('Unable to send.');
$this->_redirect('');
}
}
这是我计划用来发送 email.Above 控制器函数的函数,该函数在单击提交按钮时被调用。
然后我在 Magento 管理面板中配置了外发 SMTP 电子邮件。
系统>配置->邮件发送设置
我按照上面的路径在邮件发送设置中添加了HOST和PORT并保存了config.HOST和PORT 是从电子邮件服务获得的 provider.But 当用户填写表格并单击提交时,而不是发送电子邮件浏览器尝试启动一个应用程序说,
这个LINK需要用应用程序打开
有人可以帮帮我吗?
我正在托管站点上工作
$emailTemplateVariables = array();
$EmailSenderName="Email Sender Name";
$EmailId="semder Email";
$emailTemplateVariables['key1'] = "data1";
$emailTemplateVariables['key2'] = "data2";
/* sent mail to //recepient */
$recipientEmail="abcd@xyz.com";
$sender = Array('name' => $EmailSenderName,
'email' => $EmailId);
$emailName = 'Email Name';
$translate = Mage::getSingleton('core/translate');
$emailTemplate = Mage::getModel('core/email_template')
->loadDefault('Any_email_template');
$emailTemplate->setSenderName($EmailSenderName)
->setSenderEmail($EmailId)
->setTemplateSubject($emailName);
$emailstatus=$emailTemplate->send($recipientEmail, $emailName, $emailTemplateVariables);
$translate->setTranslateInline(true);
if($emailstatus) {
//email send successfully
}
else {
//something went wrong
}
请确认队列中的任何邮件输入终端命令
邮箱
$emailTemplate = Mage::getModel('core/email_template')->load(1); //1 is Transactional Emails id
如果你想尝试默认以上
当用户填写表单并单击 submit.I 我正在尝试为用户发送电子邮件 submit.I 在 Magento 中创建了一个控制器并包含以下代码
public function sendMailAction(){
$html="put your html content hereblah blah";
$mail = Mage::getModel('core/email');
$mail->setToName('Your Name');
$mail->setToEmail('sadeeenadeee@gmail.com');
$mail->setBody('Mail Text / Mail Content');
$mail->setSubject('Mail Subject');
$mail->setFromEmail('Sender Mail Id');
$mail->setFromName("Msg to Show on Subject");
$mail->setType('html');// YOu can use Html or text as Mail format
try {
$mail->send();
Mage::getSingleton('core/session')->addSuccess('Your request has been sent');
$this->_redirect('');
}
catch (Exception $e) {
Mage::getSingleton('core/session')->addError('Unable to send.');
$this->_redirect('');
}
}
这是我计划用来发送 email.Above 控制器函数的函数,该函数在单击提交按钮时被调用。 然后我在 Magento 管理面板中配置了外发 SMTP 电子邮件。
系统>配置->邮件发送设置
我按照上面的路径在邮件发送设置中添加了HOST和PORT并保存了config.HOST和PORT 是从电子邮件服务获得的 provider.But 当用户填写表格并单击提交时,而不是发送电子邮件浏览器尝试启动一个应用程序说,
这个LINK需要用应用程序打开
有人可以帮帮我吗? 我正在托管站点上工作
$emailTemplateVariables = array();
$EmailSenderName="Email Sender Name";
$EmailId="semder Email";
$emailTemplateVariables['key1'] = "data1";
$emailTemplateVariables['key2'] = "data2";
/* sent mail to //recepient */
$recipientEmail="abcd@xyz.com";
$sender = Array('name' => $EmailSenderName,
'email' => $EmailId);
$emailName = 'Email Name';
$translate = Mage::getSingleton('core/translate');
$emailTemplate = Mage::getModel('core/email_template')
->loadDefault('Any_email_template');
$emailTemplate->setSenderName($EmailSenderName)
->setSenderEmail($EmailId)
->setTemplateSubject($emailName);
$emailstatus=$emailTemplate->send($recipientEmail, $emailName, $emailTemplateVariables);
$translate->setTranslateInline(true);
if($emailstatus) {
//email send successfully
}
else {
//something went wrong
}
请确认队列中的任何邮件输入终端命令 邮箱
$emailTemplate = Mage::getModel('core/email_template')->load(1); //1 is Transactional Emails id
如果你想尝试默认以上