SendGrid can track when the emails are opened:
How to get a notification (via email) when emails are opened, for which the recipient is different to myself#gmail.com? (I don't want to receive a notification when I open my own emails sent to myself as BCC).
Do I need to use the SendgridAPI? How? Can I ask Sendgrid to send a notification? (To my server, who will send the notification? To something else?)
The solution is to go in Dashboard > Settings > Mail settings > Event notification.
Then here is a possible eventlistener.php:
<?php
$postdata = json_decode(file_get_contents("php://input"));
foreach ($postdata as $event)
{
if (($event->event === 'open') && ($event->email !== 'myself#gmail.com'))
{
mail('myself#gmail.com', 'Mail to ' . $event->email . ' opened', 'Opened.', "From: myself#gmail.com");
}
}
?>
Related
I am using the following script to email our website users:
function mailerExpressBlueHost(array $mailInputs){
require_once '../../includes/phpmailer/PHPMailerAutoload.php';
$mail = new PHPMailer();
$mail->IsMail();
$mail->SetFrom('swag#sustainablewestonma.org');
$mail->addAddress($mailInputs['addAddress']); // use for production;
$mail->AddBCC("swag#sustainablewestonma.org"); // set BCC: counts as part of the 500 limit;
$mail->AddEmbeddedImage("../images/newswagimageSmall.jpg", "swag-logo");
$mail->Subject = $mailInputs['subject'] ;
$mail->Body = $mailInputs['body'];
$mail->IsHTML(true);
$mail->ContentType="text/HTML";
if(!$mail->send()) {
$msg = 'Message could not be sent.' . 'Mailer Error: ' . $mail->ErrorInfo;
}else{
$msg = 'Message has been sent';
}
$mail->ClearAddresses();
return $msg;
}
when viewing the email in ms outlook the email looks like:
but when viewed on an Iphone it looks like:
Is there a way to either hide or place in the header the subject line instead of it appearing in the body? (the subject line being: SWAG Mailing List Confirmation!)
This is just a difference between email clients. There's nothing you can do about it.
Separately, you are using a very old version of PHPMailer (so update it), and you can remove these lines from your script as they're not doing anything:
$mail->IsMail(); //This is the default, so does nothing
$mail->ContentType="text/HTML"; //Calling isHTML does this for you, but correctly
$mail->ClearAddresses(); //This does nothing as the instance is destroyed when it goes out of scope
I am using WooCommerce order status manager plugin for custom order statuses and emails notifications. I have created custom status for paid orders via card pay - card-on-hold.
I have also created custom email which will be triggered when statuses will change from receivet to card-on-hold.
my code is:
add_filter( 'woocommerce_email_attachments', 'attach_manual_pdf_to_email', 10, 3);
function attach_manual_pdf_to_email ( $attachments, $status , $order ) {
$allowed_statuses = array( 'customer_processing_order', 'customer_on_hold_order', 'customer_order_status_email' );
if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) {
$dokument = get_template_directory() . '/woocommerce/emails/attach.pdf';
$attachments = $dokument;
}
return $attachments;
}
Email Ids customer_processing_order and customer_on_hold_order works like a charm.
But customer_order_status_email which is php template for order status manager is not working. It is located in betheme/woocommerce/emails/customer-order-status-email.php and I did also try to move it to same locations where other templates are but that did not help.
Any idea how to make this working please?
okay i did find a solution:
i did use echo '<pre>'; print_r($email->id); echo '</pre>' in template of an email which printed me an email ID. i used this id in my allowed statuses and it is working now.
I am trying to send mail to recipient one at a time.My code is like this:
$message = new YiiMailMessage;
$message->view = "mail";
$params = array('sendEmail'=>$values);
$message->subject = $values['subject'];
$message->setBody($params, 'text/html');
$message->from =$values['email_from'] ;
$message->addTo($values['email_to']);
if(Yii::app()->mail->send($message)){
Yii::app()->user->setFlash('success','Success sending email. ');
$this->redirect(array('mail/admin'));
}else{
Yii::app()->user->setFlash('error','Error while sending email. ');
}
Mail is received by recipient but same mail is received twice.
Maybe you are using a create action to notify the user each time a new record is created. Verify Yii::app()->mail->send($message) appears one time in your action, for example:
public function actionCreate()
{
$model= new MyModel;
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
if(isset($_POST['SomeForm']))
{
$model->attributes=$_POST['SomeForm'];
if($model->validate()){
if($model->save()){
$message = new YiiMailMessage;
$message->setBody('<h1>mets-blog.com</h1>','text/html');
$message->subject = 'Service';
$message->addTo('mets#blog.com');
$message->from = 'your#email.com' you want
Yii::app()->mail->send($message);
$this->redirect(array('view','id'=>$model->id));
}
}
}
$this->render('create',array(
'model'=>$model,
));
}
maybe you are calling your action twice in your controller by render your view.
As in the title, I need to have a copy of all emails through Magento to a specific email address.
In which file I've to work and how can I obtain the result?
Thanks in advance
System > Configuration > Sales > Sales E-Mails. Navigate to each email type then Send Order Email Copy To and set the Method to BCC via Send Order Email Copy Method.
Or
$mailTemplate->setTemplateSubject($mailSubject)->addBCC('youremail#add.ress')
->sendTransactional($templateId, $sender, $email, $cus_name, $data, $storeId);
Unlike addBcc,addCc is not defined in class Mage_Core_Model_Email_Template. You can either extend Mage_Core_Model_Email_Template class to include addCc method in a similar fashion as addBcc, or modify your code like this:
// Send Transactional Email
try{
$mail = Mage::getModel('core/email_template');
$mail->getMail()->addCc('abc#gmail.com');
$mail->addBcc('abcd2#gmail.com')
->sendTransactional($templateId, $sender, $recepientEmail, $recepientName, $vars, $storeId);
}
catch(Exception $e){
print_r($e);
}
Im developing a website wherein you can inquiry our ask question via email. every time i send it, it always goes to spam
here is my code:
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$city = $_POST['city'];
$QuestionComment = $_POST['comments'];
$hear = $_POST['about_us'];
$email_address = $_POST['email'];
// the first email is for thank you! email
date_default_timezone_set('Asia/Manila');
$mail = new PHPMailer();
$body = "Hi,<br /> <br />Thank you for contacting Magosaburo Philippines. <br />Please await for a confirmation email regarding your reservations and other concerns.";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.magosaburo.com.ph"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "mail.magosaburo.com.ph"; // sets the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "//dont mind it"; // SMTP account username
$mail->Password = "//dont mind it"; // SMTP account password
$address = $email_address;
$mail->AddAddress($address);
$mail->Subject = "Thank you from Magosaburo";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->SetFrom('send_mail#magosaburo.com.ph', 'Magosaburo');
$mail->AddReplyTo("send_mail#magosaburo.com.ph",'Magosaburo');
$mail->MsgHTML($body);
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message sent!";
}
Im new in php email sending i dont know how or why it goes to spam. thank you!
Use a DK/DKIM signature in your mail, that might help.
If it's just gmail that's categorizing you as spam you may be on their blacklist, here's some info on getting off that. Then there's headers, there's an example of headers in action on this SO post. And finaly, on an email by email basis there's a few additional tips here.
Summary: 1. Check if you're IP is actually on google's spam list. 2. Use headers so provide filters with a more complete information on your emails. 3. Address any potential "spammy looking" content.
Good luck!
Its because of the fact that. The email providers have their own preferences about the email senders.
If the server from which you send emails is based on a malware. The email company will block them. Basically because the user has already marked the server as Spam. And the new emails are sent to the Spam!
Try adding some more information. Like a signature. Or try to read their user guides on how to remove or send a request to the email service to check that the emails you send are not malware!