Forum Moderators: open

Message Too Old, No Replies

script to open email with subject and field

         

mixtax13

4:29 am on Sep 10, 2008 (gmt 0)

10+ Year Member



Hello
I have built this web for a NFP NGO.
The Follow script is to open an email fill with content. It work fine in firefox 3 and safari on mac. on PC works in IE 6 & 7 but does not work in firefox 3 on PC, Can anyone please help.
Thanks

<snip>

<script type="text/javascript">

function mailThisMsg() {
var recpt = "info@example.ccTLD"
var subj = "FASTER BETTER SOONER: Look at Monash Rowville rail now"
var text = "<Enter your name and address here> %0D%0DMelbourne is growing and more people need transport. With concern about climate change and rising petrol prices, Melbourne's growth is not sustainable without more and better public transport.%0D%0DVictorians want more people catching public transport, cycling and walking; fewer trucks on our roads, more freight on rail; and fewer kilometres travelled by car and truck.%0D%0DPublic transport should: be fast, frequent, reliable, affordable and safe; grow as Melbourne grows; be available to all Melbournians; and be managed as an integrated, co-ordinated network.%0D%0DThis means bringing forward existing public transport projects, committing to new projects and accelerating programs to move freight off our roads and onto rail.%0D%0DIt also means looking very closely at the impact on greenhouse gas emissions of any new transport projects like tunnels and freeways.%0D%0DWe especially urge you to look at a feasibility study for a Monash Rowville rail line. %0D%0DAs Melbourne's population grows, better public transport will both reduce traffic congestion and provide a much needed antidote to spiralling petrol prices. "
var bcc = "people@example.ccTLD"
var content = new Array()

content[0] = "mailto:"
content[1] = recpt
content[2] = "?subject="
content[3] = subj
content[4] = "&body="
content[5] = text
content[6] = "&bcc="
content[7] = bcc
content = content.join("")
window.location = content
}

</script>

[edited by: DrDoc at 5:50 pm (utc) on Sep. 12, 2008]
[edit reason] No specifics, please. See forum posting guidelines. [/edit]

daveVk

5:58 am on Sep 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should not have spaces etc in mailto url

try

content[0] = "mailto:"
content[1] = encodeURIComponent( recpt );
content[2] = "?subject="
content[3] = encodeURIComponent( subj );
content[4] = "&body="
content[5] = encodeURIComponent( text );
content[6] = "&bcc="
content[7] = encodeURIComponent( bcc );

piatkow

12:01 pm on Sep 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It worked for me under XP, IE6 and Outlook. Mailto isn't consistently supported between email clients, you need to test this on more than just Outlook as well as on multiple browsers. Also remember that you are excluding anybody who uses webmail.

mixtax13

12:31 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Thanks for you help. I forgot about webmail. I will need to set up a link for people to get the content of the email incase the button does not work for them.

piatkow

10:07 am on Sep 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just to add to my previous post, don't assume that Outlook and Outlook Express will act the same. Last time I used a complex mailto (many years and several releases of Outlook ago) they were not consistent.

Of course, if you don't have an overriding business reason for using a mailto then PHP would be a more reliable solution. There are third party processors if you are using a "lite" hosting package without PHP.

mixtax13

9:03 pm on Sep 12, 2008 (gmt 0)

10+ Year Member



Hi Piatkowm,
No overriding business reason to use mailto, just ignorance.
We have full hosting with php5. I will see I can track down some PHP script. Do you know any?
Thank you.