Hi folks,
Got a problem - I've got all my automated emails (in HTML format) stored in a table in my DB (called tbl_emails). I've set up a trigger so that every time a new user registers (data put into tbl_users), it creates a validation code using UUID(), and outputs an email into my mail pickup folder (idea being that if the user clicks on the link contained in the email, they get validated).
Code looks like this: -
SELECT CONCAT("To: ",NEW.CltEmail),
-
"From: myemail@cmdev-associates.com",
-
"Subject: New User Registration", "",
-
REPLACE(
-
REPLACE(
-
REPLACE(tbl_emails.EmailContent,'{0}',NEW.CltEmail)
-
,'{1}',NEW.FName)
-
,'{2}',NEW.EmlCode)
-
INTO OUTFILE "//mymailpickup//email.eml"
-
FROM tbl_ocemails WHERE EmailID = 1
-
FIELDS TERMINATED BY "\b\n";
-
My problem is that the email contents are meant to be HTML but I'm testing it by registering myself and I'm only receiving the HTML code in plain-text - entirely unformatted. Not only that but I'm getting double slashes (\ \) at the end of every line break in the email content. What am I missing here?
Many thanks in advance,
medicineworker
8 3717
Heya, medicineworker.
To send HTML emails, you need to set the Content-type header for your email. See this page for more information.
The '\ \' that you're seeing is probably an escaped "\r\n".
Hi pbmods,
Thanks for that, I found the Content-Type header tip (and MIME-Version) thru Google and added that as an extra field, but now I'm hitting a new stumbling block - the email message itself is completely blank (with the exception of "no virus found" put there by my anti-virus)! Any more ideas?
Many thanks
medicineworker
Heya, Medicineworker.
Can you view the .eml file directly? Is your MySQL query generating an error?
Hi pbmods,
Found the solution to part of my problem - forgot to put a blank line between email headers and the actual content, so the email is now arriving as an HTML email (to an extent).
I'm still getting backslashes at each line though (which I'm guessing is a problem to do with FIELDS TERMINATED BY)?
Problem is now 99% fixed though, which is better than nothing!
Many thanks,
Benjamin
P.S. MySQL trigger doesn't generate any errors - but have had bad mail pickups previously when it hasn't outputted the data in the intended fashion (all working error-free now, with the exception of the dreaded \).
Hi pbmods,
And the problem is finally solved! FIELDS TERMINATED BY "\b\n" ESCAPED BY "\\" is the MySQL default - so I removed the escape characters ("\\") and it works a dream!
Thanks for your help,
medicineworker
Heya, medicineworker.
Interesting. Thanks for posting the solution.
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Hi pbmods and medicine worker,
Thanks for working thru this thread. It has given me a start in figuring out how to send HTML emails. Thanks again.
Hi BenMore,
If you do need any help, or just want to take a look at the code I've sussed out so far, then drop me a PM/email and I'll send you the triggers and code I'm currently using.
medicineworker
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Marco |
last post by:
Hello there ;)
I'm trying to build a scrip that would open a page that has a table and then
get all the values as variables so I can put them in a MySQL DB.
The problem is that I don't really...
|
by: John |
last post by:
Hi all,
I am doing the change from having worked in Oracle for a long time to
MS SQL server and am frustrated with a couple of simple SQL stmt's. Or
at least they have always been easy.
The...
|
by: David Bradbury |
last post by:
I currently have an iframe on a webpage into which users can insert
content. They can further customise the text as I've included buttons
such as Bold, Italic, Bullet point etc. This is done along...
|
by: Werner Eggert |
last post by:
Hello,
i have a frameset with 3 rows. The top row of the frame has a table
(height: 50px). This table should be aligned on bottom of the Top-Frame
(height: 100px). The problem: at the moment the...
|
by: Andy Flash |
last post by:
Hi.
I'd like a little help working out what is going on with what should
be a simple alignment problem.
I have an outer table with a <td> which has an inner table.
The <td> specified as...
|
by: ALI-R |
last post by:
Hi All,
I have two user controls (header and footer) ,,which I've placed in an HTML
Table in a page.I set the **align="center"** in the table and the table
still is on the left side of the page...
|
by: Sundew Shin |
last post by:
I think I can make a good interesting list of postings under this
subject header, 'All browsers are cool but IE.'
Anyway, the following code will show a table with an input box labeled,
'name',...
|
by: Albin |
last post by:
Hi,
I have a html page where in the table spans for two pages
the first page's last row doesn end properly and the 2nd page's first row also isnt proper.The code i use is given below,the no of...
|
by: Michael.Z |
last post by:
Anyone who can help:
Given a Table.h file I am writing a Table.c file.
I keep getting the compile error:
previous declaration of Table was here / conflicting types for
I think the...
|
by: RubbedLung |
last post by:
http://www.hometeamproperties.net/Forms/PVA/LPV.htm
As you can see its a valid page but now the bottom right rounded corner is gone, and there are entire blocks of color missing from the interior...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |