Can't sieve reply to certain received E-Mails by a predefined E-Mail? - dovecot

Our hosting provider supports sieve E-Mail rules, and they are perfectly working, e.g., to move received E-Mails based on a Regex.
But now, if someone writes to office#mydomain.com,
then we must reply with an E-Mail like "Thank you for your E-Mail" to explicitly confirm that the Server received the message.
Does Sieve not have a simple "Answer by E-Mail" function by default?
As a workaround, I have tried to use the vacation rule, but it never sends an answer. And we should confirm each message, and we can not set :days 0 if the hosting provider does not allow it.
In case it helps, I have added our Sieve rule below.
After all, it would be much better to send one email per day than never :-)
Does anybody know a solution?
if allof (header :contains "to" "office#mydomain.com")
{
vacation
:days 1
:subject "Thank you for your message!"
:from "NoReply#mydomain.com"
text:
    Here, we have the email message
.
;
stop;
}

Related

Exceeding maximum subject length using message.forward

I have searched the site, and the web, but have had no joy.
I have a google apps script attached to a spreadsheet that (among other things) forwards emails with a given label to a given email address. I recently sent an email with a very long subject line, and the script has started failing on the following line of code:
msgsToStore[l].forward(emailAddress);
The error I receive is "Argument too large: subject"
The subject of the original email is 283 characters. Forwarding the message within the gmail web interface works without difficulty, adding "Fwd: " to the beginning as you would expect. The subject contains an ampersand, but is otherwise not unusual.
I need something I can use other than .forward, or some way of modifying the message object before forwarding it, but I can't find any documentation as to what the maximum size is.
Any help is greatly appreciated.
Trim the subject:
trimmed_subject = msgsToStore[l].getSubject().substring(0, 250)
msgsToStore[l].forward(emailAdress, {
subject: trimmed_subject,
});
More details: https://developers.google.com/apps-script/reference/gmail/gmail-message#forward(String,Object)

PHP: view unsuccessful emails

I'm trying to figure out how to display a list of unsuccessful emails sent and a way to test it out.
I can display a list of the emails that were sent, but I'm unsure on how to retrieve the list of emails that were unsuccessfully sent out.
Here is what I'm using to retrieve it from the mysqldb:
//get the email address list
$query = "SELECT email FROM users
WHERE id IN (SELECT participant_id FROM roster AS ur WHERE ur.roster_id=".$roster['roster_id'].")";
$result = mysql_query($query);
$emailstring2 = "";
$email2 = $result;
while ($row = mysql_fetch_object($email2)){
$emailstring2 .= $row->email. "\n ";
}
In the message section, I retrieve it via:
$message .="Successful emails: \n".$emailstring2." \r\n";
How would I achieve this?
One keyword will get you the ones not sent: NOT
WHERE id NOT IN
You can't do this from PHP in a simple manner like this.
Think of it as a letter going through the postal service. All you can do is give the letter to the postman and hope that it reaches its destination. The postman will not come back and tell you if delivery was successful, or if the letter was actually read by the recipient. PHP's mail() function (and its derivatives) return TRUE to indicate that the message was accepted for delivery attempts, not that it was successfully delivered. (Delivery may not happen for hours or days.)
As a result, the best you can do is approximate delivery notification. There are a few ways you can do this:
Use a tracking pixel in the email that gets pinged when the user
opens the message. However, given that most email clients nowadays
default to "do not show images," I think this technique is rather
unreliable.
Send each message with a bounce address unique to the recipient. If
the message can't be delivered, it will return to the custom address
-- and that return message can be used to indicate that the original recipient's email address is no good. This is probably the most accurate method but is not simple to configure.
Use return receipts. Like tracking pixels, I think most email clients
default to never send these, so this is likely unreliable as well.
Use delivery status notification. This will require using a server
that supports it and sending to a server that supports it.
Send your mails through a service that will do this sort of tracking for you. (E.g. MailChimp or Constant Contact)

How to setup an SMS alert to website owner when a customer fills in a form?

Been doing some research on how to setup an SMS alert straight to the website owner's (our customer) phone when a website visitor fills in a form on his website. Obviously we're happy to sign up to a provider and pay a few cents for each message - not expecting this to be a freebie service.
A lot of the google results you get for this deal with bulk texting out to the many recipients which isn't what we're looking at here.
So what's the simplest small-scale way to achieve this via HTML and simple scripting?
This daniweb forum post offers clear and simple instructions using Coldfusion and that's fine but as it's 7 years old we wonder if things have moved on and are there better suggestions?
We'd be happy to script it very simply through ASP.NET or PHP or something else, but hoping to keep it lightweight, since this is a very simple website belonging to a small business.
I am working on a similar thing for my company.
We use a GSM modem such as: ZTE MF668A
It is a USB adapter which you can insert a SIM card into.
We purchased an SMS only plan, which is like $15 a month and you can send unlimited SMS. However the set up might be a bit more complicated than just using a bulk SMS service.
You can set up Diafaan SMS Server (http://www.diafaan.com/) on the computer with the GSM Modem to accept emails for a particular domain. (e.g. ours is #sms.com). Our exchange server forwards email to the Diafan Server. Diafaan will take the email and convert it to an SMS and send it using the GSM modem.
In you php code, you can use PHPMailer (http://phpmailer.worxware.com/) to construct an email and set the mail to address to be #sms.com.
You use it something like this:
ini_set("sendmail_from","user#company.com");
ini_set("SMTP","smtp.company.com");
require("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.company.com"; // specify main and backup server
$mail->SMTPAuth = false; // turn on SMTP authentication
//$mail->Username = "name"; // SMTP username
//$mail->Password = "password"; // SMTP password
$mail->From = "user#company.com";
$mail->FromName = $salesPerson;
$mail->AddAddress("user2#company.com", "Pricing");
$mail->AddReplyTo("user#company.com", "User2");
$mail->AddBcc($salesPersonEmail, $salesPerson);
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subject;
$mail->Body = $body;
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
There are also companies that offer SMS services such as PCSMS where you get 100 SMS per month for a fee. Then you just construct an email and send it to #pcsms.com.au. This is probably the easiest way to do it and is the way we used to do it, but the way we do it now is much cheaper.
Disclaimer, I do developer evangelism part time at Nexmo.
While you can setup a GSM modem to send SMS messages, it's likely easier (and depending on your usage, cheaper) to use a SMS API. Here are a few providers - pricing is in cents per message (depends on the API and destination, but hovers around a cent or two). You may be required to provision a virtual number - pricing there is generally dollars/month (again, depends on API and destination, hovers around a dollar or two).
Nexmo
Twilio
Tropo
If you're sending internationally, I think your best would be Nexmo. Or if you see any need to accept incoming messages in the future, Nexmo's pricing model will help you there.
All three APIs are straight forward REST/HTTP APIs - as long as whatever language you're using server side can make a web request, you should be able to send an SMS.
Eventually we used Esendex. Good support from them, decent code samples and plenty of mileage in the free trial (which in fact they were happy to extend when we asked).

EWS Body of Email coming back empty?

We are in the process of converting a batch job that processes our bounced emails that we send. We are switching from Redemption to EWS (just upgraded to Exchange 2010 from Exchange 2003). As you know bounced emails come in different forms. I have been able to work through all the test case emails i've got except for the ones that come in the form of:
Your message did not reach some or all of the intended recipients.
Subject: Hello
Sent: 4/01/2012 8:16 AM
The following recipient(s) cannot be reached:
hi#foo.com on 4/01/2012 8:19 AM
The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system administrator.
smtp.mydomain.com #5.0.0 smtp; 5.3.0 - Other mail system problem 554-"delivery error: dd This user doesn't have a foo.com account (hi#foo.com) [-5] - mail.foo.com" (delivery attempts: 0)>
This is what is displayed in outlook. When i read the email with EWS the Body is empty. I need to look at the information above when i get the email with EWS. The emails have an attachment (which is the original email) though it doesn't look that way in outlook. I've tried to look at almost all the properties that comes back from EWS and have yet been able to find the text above. Redemption allow you to look at this info using ReportText. What we are specifically looking for is the email error delivery code. We do different things based on this code.
Edit: To be clearer the Body Property on my other test cases isn't empty. I'm loading the emails like:
Dim emailPset = New PropertySet(BasePropertySet.FirstClassProperties)
emailPset.RequestedBodyType = BodyType.Text
Dim f = EmailMessage.Bind(email.Service, email.Id, emailPset)
Update1: After some research it looks like i need to be able to read the Recipients table of the message in the PR_NDR_STATUS_CODE & PR_REPORT_TEXT fields. Still searching if there is a way to do this in EWS.
We were able to get enough info the
smtp.mydomain.com #5.0.0 smtp; 5.3.0 - Other mail system problem 554-"delivery error: dd This user doesn't have a foo.com account (hi#foo.com) [-5] - mail.foo.com" (delivery attempts: 0)>
part which is what we needed by telling the object to load the MIME content.
Definitely not the most straight forward API to use but hopefully we don't hit any more hickups.

using boto and SES, emails with links don't go through

Something really weird is going on with boto and Amazon SES. I've tested this at-least 50 times: Sending an email using:
conn = SESConnection(accessKey, secretKey)
conn.send_email(source=fromEmail, subject=subject, body=body, to_addresses=toAddress, cc_addresses=cc_addresses, bcc_addresses=bcc_addresses, format='html', reply_addresses=None, return_path=None)
works as long as the body is regular text. A soon as body contains a link, like "127.0.0.1", the email doesn't go through. send_email doesn't return an error, it just doesn't go through and I can't tell why. The only exception is if the link is the very last piece of text in the body. So, body = "go to 127.0.0.1" will get into the recipients' inboxes, but body = "go to 127.0.0.1 and click on the link" will not work.
Weird, right? What's going on?
EDIT, several wasted hours later:
So after killing several hours on this, I don't know exactly what the problem is, but I know that it doesn't have to do with Boto or Amazon SES. I sent the exact same email to a different address and had no problems with it. Now this is seriously weird and stupid. The email used for my school runs on Google apps and exhibits the wacky behavior described above. My personal email is plain old gmail and doesn't have this issue at all. I even checked the spam folder for my school email and it's not there.
So that's it, the difference between having an "http" and an "https" in the body of the email, and only for certain email accounts. No errors, just a lost email. WTF?