Jump to content

GUI for email mailto generation?


Recommended Posts

I wouldnt say that its a longshot at all :whistle:

I dont know how much javascript you know, but if you look at the HTML code of the page, its not really that hard. All it does is check which inputs in the form have valid text in them, and then it writes the code which is also simple:

<a href="mailto:email@domain.com?element=text&element2=text">Text to display</a>

Here is an example

<a href="mailto:bob123@spambob.com?subject=OMG!&body=NO WAY!!!">Check this out!</a>

Hope this helps

Link to comment
Share on other sites

@Diana (Cda)

Maybe My Email address Encoder can help you out.

Email Address Encoder

regards

ptrex

Very kewl! I dl and tried the email encoder and it loosk splendid. I'll definitely give it a try once I get my own webpage up! Thanks for that.

Thanks for both responses. I thought of saving the page and trying out the code. Indeed, after posting, I did give it a try. It works quite well. The difficulty is this, I'm using it for another purpose other than that specified. What I need to do a lot at work is email at pre-defined times. For example, I had a reminder to send an email daily to my family. I don't need the reminder, of course, it's the coding that counts.

Here's what I mean, if I dump the word "Test" into each box, I get this result:

mailto:test&cc=tes&bcc=test&subject=test&body=test"test

That is almost okay. I have to remember to delete the last bit, "test, for it to work.

If you make up a reminder such as I've described and put this type of code in, you'll get an email msg box come up partially populated ready to go. This is great for those repetitively addressed to friends and family that just need different date and, of course, different message <g>. So the script I modified is almost perfect. I did it through trial and error. I'm a dunce when it comes to many forms of scripting, but this one was not too bad to modify.

But if I can beg the indulgence of the group. I know it's not an AI issue but you're all such experts here, it seems (at least compared to me) ... can someone help me to get the javascript to only generate this type of line of coding?:

mailto:test&cc=tes&bcc=test&subject=test&body=test

Javascript code I came up with:

      &lt;script language=Javascript>
var theCode;
var isReady;
function createCode(){
theCode = '';
isReady = false;
if (document.mailForm.toAddress.value == ""){
    alert('You must have a To address.');
    document.mailForm.toAddress.focus();
    return;}
if (document.mailForm.toAddress.value != ""){
    theCode="\mailto\:"  +
    document.mailForm.toAddress.value+"&";}
if (document.mailForm.ccAddress.value != ""){
    theCode +="cc=" +
    document.mailForm.ccAddress.value +"&";}
if (document.mailForm.bccAddress.value != ""){
      theCode +="bcc=" +
      document.mailForm.bccAddress.value +"&";}
if (document.mailForm.theSubject.value != ""){
    theCode +="subject=" +
    document.mailForm.theSubject.value +"&";}
if (document.mailForm.theBody.value != ""){
    theCode +="body=" +
    document.mailForm.theBody.value;}
theCode += "\"";
if (document.mailForm.theLink.value == ""){
    alert('You must have text for the link.');
    document.mailForm.theLink.focus();
    return;}
if (document.mailForm.theLink.value != ""){
    theCode +=
    document.mailForm.theLink.value;}
theCode += "\n";
document.mailForm.showCode.value = theCode;
isReady = true;
}
var testWindow = null;
function doTestWindow(){
if (!isReady) return false;
if (document.mailForm.showChecked.checked){
closeTestWindow();
testWindow = null;
testWindow = window.open("about:blank","a","left=100,top=100,screenX=100,screenY=100,width=200,height=200");
with (testwindow.document){
  writeln('<html><head><title>Email Test</title><scr'+'ipt>self.focus();self.moveTo(200,200);</scr'+'ipt></head>');
  writeln('<body bgcolor=#202020 link=#00ff00 vlink=#00ff00 alink=#00ff00>');
  writeln('<font face=Arial size=2 color=#ffffff>');
  writeln('Test your code by clicking on the link below.<br><br>This will open the link in your default email client.<br><br>');
  writeln(theCode);
  writeln('</font>');
  writeln('</body></html>');}
}}
function closeTestWindow(){
if (testWindow != null && testwindow.open) testwindow.close();
}
function selectTheCode(){
if (!isReady) return false;
document.mailForm.showCode.focus();
document.mailForm.showCode.select();
}
</SCRIPT>
I'm not sure that anything else is needed from that page.

Thanks and really appreciate any help and I promise never to do this again (putting in script that isn't AI).

Cheers.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...