Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript Email Messages formating and bcc problems

Status
Not open for further replies.

yajmere

Programmer
Jan 3, 2002
12
0
0
US
Hi
I have couple of problems when using "mailto" to send emails.
1. If i execute the following code, it pops me an alert message in browser stating that "This form is submitted using e-mail. Submitting this form will etc etc. "
Is their any way i can get rid of this alert box.

2. Here I have formatted text text message using '\n' for new line characters. It shows new lines properly formatted in alert but when i recieve message their is no new line or any formating.

3. When i try to send bcc mails using something like
var act="mailto:?bcc" + toaddrs + "Subject=" + Sub + "&Body=" + msgbody;
Then it just does not send any mails.

Javascript Email Messages to group of users

<HTML>
<head>
<script language=javascript>
function AddData(){
var toaddrs;
var ccadrs;
var Sub;
var msgbody;

toaddrs='yajmi@abc.com';
ccaddrs=&quot;treng@abc.com&quot;
Sub=&quot;CONGRATULATIONS!!!&quot;;
msgbody=&quot;Congratulations! \n You have qualified for the Honor Ring award. \n Please go to the URL below and register the information requested. \n&quot;
msgbody=msgbody+&quot;\n\n for all of your hard work, and enjoy your award.\n\nThanks,\n\nThe Support Team&quot;

var act=&quot;mailto:&quot;+toaddrs+&quot;?Subject=&quot;+Sub+&quot;&Body=&quot;+msgbody;

//alert(act);
document.forms[0].action=act;
//alert(document.forms[0].action);
document.forms[0].submit();

//<A href=&quot;mailto:?bcc=yajmi@abc.com&quot;>
}
</script>
</head>
<body MS_POSITIONING=&quot;GridLayout&quot; onload=&quot;AddData()&quot;>
<form id=&quot;Submit&quot; method=&quot;post&quot; runat=&quot;server&quot;
action=&quot;mailto:yajmi@allstate.com?Subject=New Subject&Body=This is the
message body&quot;>
<!-- <INPUT type=&quot;button&quot; NAME=&quot;a&quot; onclick=&quot;AddData()&quot;>-->
<INPUT type=&quot;hidden&quot; NAME=&quot;aaa&quot;>
<!-- <INPUT type=&quot;submit&quot; value=&quot;Submit&quot;>-->

</form>
</body>
</HTML>
 
1. I'm not sure if it's possible.

2. There are so many problems with email clients compatibility, that's I'd not recommend to base on any of solutions you may find. What email client do you test in? MS Outlook? What about others?

I used to &quot;play&quot; with these things once and tried OExpress, Netscape email client, Opera built-in email client and some else. There were almost NO any single thing that was executed the same way. &quot;\n&quot; is among them.

3. var act=&quot;mailto:?bcc&quot; + toaddrs + ...
It seems that the problem is here: &quot;mailto:?&quot;. There should be something before &quot;?&quot;.
I think you should always add the main address you're sending email to, and only then add BCC address:
&quot;mailto:first@site.com?bcc=another@site.com&subject=some%20info&quot;
 
I am testing using MS Outlook 2000. Users will always be using Outlook client because it has been standardized.
 
I didn't manage to do this in Outlook. It was one of the worst cases.
Another option is to replace '\n' to '%0d' - it worked for Opera mailer, but not in Outlook.

You can try to create an html email, this will be easier to control there. Try to pass html code to the message body and specify <form enctype=&quot;text/html&quot;> or <form enctype=&quot;multipart/form-data&quot;>.
I didn't tried it. Search for the reference of aproppriate enctypes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top