=?UTF-8?B??= in Emails sent via php mail problem - linux

I have a website, and in the "Contact" section I have a form which users may fill in to contact me.
The form is a simple form which action is a php page.
The php code:
$to = "email#domain.com";
$name=$_POST['name']; // sender name
$email=$_POST['email']; // sender email
$tel= $_POST['tel']; // sender tel
$subject=$_POST['subject']; // subject CHOSEN FROM DROPLIST, ALL TESTED
$text=$_POST['text']; // Message from sender
$text.="\n\nTel:".$tel; // Added to message to show me the telephone nr to the sender at bottom of message
$headers="MIME-Version: 1.0"."\n";
$headers.="Content-type: text/plain; charset=UTF-8"."\n";
$headers.="From: $name <$email>"."\n";
mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $text, $headers, '-fno-reply#domain.com');
Could somebody please tell me why this works most of the time, but sometimes I receive email whith no text and the subject line showing
=?UTF-8?B??=
I use outlook express, and I have read this System.Net.Mail and =?utf-8?B?XXXXX.... Headers
but it didn't help.
The problem is not in Outlook, because when I log in to the actual mailprogram where I fetch the POP3 emails from, the email looks the same.
When I right click in Outlook and chose "message source" then there is no "From" information.
Ex, a good message should look like this:
Subject: =?UTF-8?B?w5Z2cmlndA==?=
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
From: John Doe
However, the ones with problem looks like this:
Subject: =?UTF-8?B??=
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
From:
As if the information has been lost somewhere.
You should know also that I have a VPS, which I manage myself.
I use postfix as an emailserver, if thats got anything to do with it.
But then again, why does it work sometimes?
Also another thing that I have noticed is that sometimes special characters are not shown correctly (by both Outlook and the webmail).
For instance, the name "Björkman" in swedish is shown like Björkman, but again, only sometimes.
I hope anybody knows something about this problem, because it is very hard to track down for me atleast.
If you need more input let me know.

Looks like the form is posted with all fields left blank. There are bots crawling the net and submitting empty forms. Have you been able to reproduce this with actual form data?
Additional hint: your code is open to email header injection - I can post any headers I want, separated by line breaks, in $_POST['name'] and your code will put it into the email headers. At least remove any line breaks from user data that will go into the header section.

Related

How to block an email which did not sent a direct message to you?

I'm sorry I am not sure the proper wording to explain this issue.
I have constantly been receiving emails such as the one I attached (at the bottom). Altough I am able to block emails from "Order_Shipment", several email addresses remain sending messages to PennyV1#aol.com as well as PennyYA#aol.com, which is redirected to me. I could not find a way to block these two emails. I get several emails daily through them, and I would like it to stop.
Things I tried:
1 - Searched in the google settings, and couldn't find anywhere how to specifically block an email by typing the address.
2 - The three vertical dots on the left allows me to block the specific email from Order_Shipment, this does not solve the problem as the real problem is blokcing PennyV1 and PennyYA.
3 - Sent an email to PennyV1#aol.com as well as PennyYA#aol.com in the hope they would sent me an email back so I can block them. My message got bounced back saying these emails don't exist.
I do not know how my email entered this email grouplist
You could try blocking their domain:
Like clicking "Block Quora Digest" in my case.
Option two would be two create a filter: https://support.google.com/mail/answer/6579?hl=en#zippy=%2Ccreate-a-filter

Azure Logic app read my approval email in form of HTML tags

I have created a Azure Logic app to read the email body and check for the condition - If the email body 1st line has the only word called "Approved", then trigger another process or else do nothing.
But when performing it, I could see the condition gets to false even though the mail has only Approved word in it accommodated with signatures in the bottom. After researching, I could see the email is being read like HTML tags. So i created two more variable to extract a part of this e-mail and check for condition.
EmailBodyTrimmed = trim(substring(toUpper(replace(replace(trim(variables('EmailBody')),' ',''),'.',''),),0,500))
EmailBodyTrimmedFinal = trim(substring(trim(replace(trim(variables('EmailBodyTrimmed')),' ','')),0,indexOf(replace(variables('EmailBodyTrimmed'),' ',''),'<')))
But nothing seems to give correct answer. Can anyone help me ?
I think you can use Body Preview to receive the body of the email:
According to my test results, it receives the text in non-HTML format, so you don't have to extract the body from the HTML text.
Then you only need to add a condition and use starts with to determine whether it starts with approved.
Of course, this premise is that your email body is in plain text format, if it is in excel format, you need to do other processing.

How to extract the url from an embedded link in an email

I've got an email processing agent. It copies the body of the email into a document's rich text field. If there are any embedded links in the email I want to process that embedded link and extract the url. I started playing around with MIMEEntity but nothing came of it. Any ideas?
thanks
clem
================
Hi Rich,
Well here's a more robust explanation of what's going on. I have several Notes apps which deal with email correspondence. An email comes in, a Notes document is created with some meta data (system generated ID, user's email, name, company, status, etc). The email body is added to a 'correspondence' rich text field of the created Notes doc. The app allows for someone on our side to follow up on the email (ask a question, provide some feedback, etc). That response from us is pre-pended to the original email. If the original sender responds with some further information, THAT email is also pre-pended. To do this pre-pending, I do
bodyText = EmailDoc.GetFirstItem("Body").text
textFromNotesDoc = CTdoc.GetFirstItem("Issue").text
newTextFromNotesDoc = bodyText + <some stuff> + textFromNotesDoc
I then do a replace.
This worked perfectly fine for years. However, recently users have been sending in emails containing embedded links. Of course anything like that is lost when I do the NotesDocument.GetFirstItem().Text. So I've been trying to think of a way to capture the embedded link. The other day it occurred to me that if I could read the html, I could find and extract the url and simply add it to text. I thought maybe using NotesMIMEEntity would allow me to read through the body field and find the url but that's not working.
Clem
The solution is to NOT NotesDocument.GetFirstItem().Text. Just simply take the email coming in and prepend the body field to the discussion RT field. I add tags to the email going out so that I know if the person responding included the previous conversation. That took a little work to figure out but by using NotesRichTextNavigator and related classes, I'm able to deal with that.
clem

How does an ICal need to be formatted for gmail to automatically add it to your calendar?

I've been jacking around with iCal and email and through some fiddling, I've managed to get gmail to recognize that I do, in fact, have an iCal file embedded in the message. So it looks something like this:
This is accomplished by adding a third portion to the multipart email that looks something like:
--B_ALT_51b091604704b
Content-Type: text/calendar; method=REQUEST charset=utf-8
Content-Transfer-Encoding: 7bit
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//My Company LLC//My Reminder System//EN
BEGIN:VEVENT
UID:2201#example.com
DTSTAMP:20130606T134048Z
ORGANIZER;CN="Robb Nixon":MAILTO:robb.nixon#motorsolutions.com
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=
TRUE;CN=Robb Nixon;X-NUM-GUESTS=0:mailto:robb.nixon#motorsolutions.com
DTSTART:20130608T120000Z
DTEND:20130608T130000Z
SUMMARY:Follow-Up: Allan Chappell ("New Template")
DESCRIPTION:Subject Line: "New Template"\nDate Sent: "June 6\, 2013 # 8:40
AM CDT\nRecipients:\n TO: Allan Chappell (------------------)\,\n \n
Email Copy:\n\nDear Allan\,\n\nAn Introduction\n\nMy Body\n\nNext Steps\n\n
Robb Nixon\nWeb Developer\nSalve Solutions\nmotorsolutions.com\n\n\n\n
SEQUENCE:0
STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
Note, this is an example with some of the values changed... my real invite follows the folding rules to the letter. Also note that my gmail email address would be in the place of robb.nixon#motorsolutions.com as well, so in theory gmail should know that I am the organizer of the event.
When someone sends me an invite via gmail, I instead get the following:
Notice that it has "Going? Yes Maybe No" and the item is automatically added to my calendar. as it arrives to my email without having to hit the "Add to Calendar".
Does anyone know what I'm missing to make this happen for my iCal files? Or is it a Gmail thing where they recognize it's from them and go ahead and automatically add it to your calendar.
Your iCalendar stream is missing a METHOD:REQUEST property in the VCALENDAR object (i.e. below the PRODID but before the BEGIN:VEVENT.
Gmail may also get confused by the fact that you are also the organizer of this meeting.

Why do mailto links in Notes fail with double-quotes fail in Inbox?

We're sending email from Newsgator to Notes mail as part of our social implementation. It includes three links that are mailto's. The hotspot formula looks like this:
"mailto:"Like Event" <SocialActivityStream#DAIPortal.daiglobal.net>?subject=Like this activity event. This email references activity event:NGMetaEvent_0D8111ED124B8FE8693DD6C82BD0FA28_634984171780151056.&body=Send this email to like the activity event."
I would expect this to always fail, because of the multiple double-quotes.
Interestingly, it does not always fail. If you put it in your trash folder, it works. If you forward the document, the recipient will be able to click the links. If you simply edit and save the received message, the links work. The hotspot formula looks exactly the same in any of those circumstances.
So, why does it fail when I open the document from my Inbox?

Resources