Using Utl_mail package to send email on Oracle 10g grid - oracle10g

Can somebody please advice using special character in message body is allowed or not? I am using a word "month's" in the nessage body but it is getting replaced by "month?s" in the email. Please HELP!!!!

Don't use MS Word to edit your code :)
Most probably, your editor is replacing the ' with a special left- or right-pointing apostrophe.
Try copying the code into a "plain" text editor (Notepad would do fine) and re-type the ' in the code, then recompile it.

Absolutely! You can email special characters, in the Subject and the Body.
BEGIN
UTL_MAIL.send(sender => 'me#domain.com',
recipients => 'you#domain.com',
subject => 'Cards? ♠♥♦♣',
message => 'Shall we play cards? ♠♥♦♣');
END;
/
If the special characters are being replaced by "?" then either the database or the email recipient does not have a UTF8 charcaterset

Related

JavaMail, adding line breaks in plain text emails

I am using java mail api to send "text/plain" content-type emails over smtp. I am using email templates that are stored in database. In order to put line breaks in the email body, I am using \r\n. However, when the email is received the \r\n are not converted to line breaks instead they appear as text \r\n.
For example:
This line is followed by a carriage return.\r\nThis is a new line.
in the template email body appears in the received email as
This line is followed by a carriage return.\r\nThis is a new line.
instead of
This line is followed by a carriage return.
This is a new line.
I have tried using just \n and that too does not work. How can I resolve this problem?
I get same problem,
And when I add "space" before newline, It's work
But that's mean create tag " pre " for each line.
If the template contains the line breaks as separate backslash and 'n' characters, you're going to need to do something to convert it to a real "newline" character. Ditto \r. Better would be to store the template with real carriage return and newline characters to begin with.

Mandrill "reject_reason": "invalid-sender"

I'm trying to send emails using mandrill email service but I get the following error
Full Response
[
{
"email": "someemail#somedomain.com",
"status": "rejected",
"_id": "b814c2974594466cba9c904c54dca6c6",
"reject_reason": "invalid-sender"
}
]
Apart from the above error there is no more details about it. we are using .net to send emails with Mandrill SMTP settings.
It'd be useful to see the call/email that's being sent. That error means that there's an invalid sender, as indicated in the reject reason field. That could be because of an invalid email address, invalidly-encoded from name, or invalid or broken encoding in other headers making it so that Mandrill can't parse the "from" header, but without seeing the actual email that you're sending, it's hard to say for sure exactly what the issue is.
You probably want to check that there's a fully-qualified domain name in the from email address, and that if the subject line is encoded, there aren't things like newline (\n) characters that break multibyte characters in the subject line. If you aren't able to identify the issue in the raw SMTP message, feel free to get in touch with support for further troubleshooting assistance.
I had the same problem, in my case, I had forgotten to complete the template defaults "From Name" and "Subject".
I had the same problem. In my case encoding in headers was the problem. I did change the headers encoding to UTF-8 and it worked. I was using C# SMTP and the code is below.
message.HeadersEncoding = Encoding.UTF8;
Hope it works!
For me, it was because my emails were coming from email#example.net1
Mandrill rejected me because of the 1 at the end. e+mail#example.net and email#example.neta are both valid and will be accepted.
My other tests just had blank From headers, so they were rejected as well. I didn't even realize these emails were being received by Mandrill until I logged in and checked the API logs.
I've had a similar problem recently. It was due to my use of certain characters in the message.from_name field. After searching through documentation and stack overflow, I couldn't find a list of forbidden characters, so although this doesn't necessarily pertain to your case, I thought I'd share this small list I compiled of some acceptable characters (not an exhaustive list):
a-z
A-Z
0-9
_, -, !, #, $, %, \, ^, &, *, +, =, {, }, ?, .
In JS, here's a RegExp that will match with forbidden characters (or, rather, any characters that aren't in the aforementioned list):
const pattern = /[^a-zA-Z0-9_\-!#$%\^&*+={}?.]/;
Hope this is helpful for anyone else stuck on this.
If you use .NET SmtpClient, may be this is because of bug on it: https://social.msdn.microsoft.com/Forums/vstudio/en-US/4d1c1752-70ba-420a-9510-8fb4aa6da046/subject-encoding-on-smtpclientmailmessage
Workaround, that helped us:
use
message.SubjectEncoding = Encoding.Unicode;
instead of
message.SubjectEncoding = Encoding.UTF8;
This is still actual in .Net Framework 4.7.2

Why is this strange character included in emails sent from cakePHP running on my Ubuntu server?

I am seeing some strange characters appearing in emails that are sent out form my CakePHP app running on an ubuntu server.
The characters are -
D with stroke through it - Đ - this appears where I am including a cakephp variable
O with tilde - Õ - instead of apostrophe
E with accute - É - instead of ... (3 dots)
Any idea why they would be appearing? The O with tilde appears in place of apostrophes so I assume its a character encoding issue..
I am using Cake to send html emails.
any leads appreciated
thanks
Try these
1) in config/core.php search this App.encoding, the line should look like this Configure::write('App.encoding', 'UTF-8');, set it to UTF-8 if it is not.
2) In your layout, in the head section add this,
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3) Change your entire project's encoding to UTF-8 in your IDE(if you are using Zend Studio, just right click on the project and select 'properties', then select UTF-8 encoding).
Though sending email has nothing to do with database(of course if are you not fetching some data from there for sending), but you could perhaps add 'encoding' => 'utf8' line in your database.php file under $default configuration, to not have any encoding issues saving in db.
Hope it helps.

How to handle '&' in URL sent as HTML from iPhone Mail.app

Apologies if this has been answered already. There are similar topics but none that I could find pertaining to Cocoa & NSStrings...
I'm constructing a clickable URL to embed in an HTML email to be sent via the MFMailComposeViewController on the iPhone. i create the url then use stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding to polish up white space, etc. then add some surrounding HTML to get:
view
All's well so it's appended to emailBody. However once [mailComposer setMessageBody:emailBody isHTML:YES] all the & become & which isn't ideal within my URL.
can i control this? is there a better encoding algorithm? my HTML is a bit rusty perhaps I'm using the wrong encoding? I'm sure on the server I could parse the & back into & but looking for the Cocoa way...
Thanks!
Actually, & should always be encoded as & in HTML attributes. Including links. Including form value delimiters. So it's done exactly what you want, even though you didn't know you wanted it.
Look at it this way: in your URL, you have &age=53... That's interpreted first as a character entity, and only after that doesn't work is it interpreted as an ampersand followed by more character data.
The W3C spec is quite clear on this:
Authors should use "&" (ASCII decimal 38) instead of "&" to avoid confusion with the beginning of a character reference (entity reference open delimiter). Authors should also use "&" in attribute values since character references are allowed within CDATA attribute values.
That should settle it: use & not &.
Are you calling MFMailComposeViewController's
setMessageBody:isHTML:
and what do you set isHTML to?
Depending on it's setting it might very well be that MFMailComposeViewController is trying to help you out be encoding the entire message body...
Either don't encode the body yourself or make the entire body HTML.

What escaping or purification is needed for an email subject?

Sites like Facebook have the user's name in the subject line that sent you a message.
Because of this, what escaping would you do on user entered values in a message subject? Or would you just not allow anything other than a-z, 0-9, period, comma and single quotes?
You need to be careful with email headers, 8 bit chars are a bit of a no-no. (mail servers will reject them).
The proper way to do it is to MIME encode your subject lines and make sure the ASCII char \n is not in the subject line (technically multi-line subjects are possible, but I'd imagine plenty of mail clients would have problems)
See http://en.wikipedia.org/wiki/MIME#Encoded-Word for more info.
Escaping is needed if there are forbidden characters. The subject is terminated by a NL so this is the only (ASCII) character that shouldn't be put in the header.
See also rfc821
It’s the same problem with contact forms.
If you look at an email header you get e.g. this:
Subject: user123 has sent you an invite
From: "User123" <user123#example.org>
You have to make sure that user names do not resemble values of an email header. If it’s possible for a user to name himself “To: spamreceiver1#example.org, spamreceiver2#example.org, spamreceiver3#example.org, spamreceiver4#example.org” you have to clean the input.
A search for “contact form spam” should show you what to do. You should at least remove all occurrences of "To:", "Subject:", "From:" etc.