Link to home
Start Free TrialLog in
Avatar of DevoinIT
DevoinIT

asked on

Sending Email using Javascript

I am getting a debug error stating ";" missing colon. This code does not work. I am using classic asp

  function SENDRMS()
        {      
            set myMail=CreateObject("CDO.Message")
            myMail.Subject="Commercial Loan Advance Draw"
            myMail.From="druffin@anchorbank.com"
            myMail.To="druffin@anchorbank.com"
            myMail.TextBody="This commercial loans needs to be approved."
            myMail.Send
            set myMail=nothing
        }




<input id="RM" type="button" value="Click Here to Send TO RM's Approve" onclick="javascript:SENDRMS();"
                                                      NAME="RM">
Avatar of ConnerT
ConnerT

You can't send an email directly with javascript.

However you can open the user's mail client:

window.open('mailto:test@example.com');

There is also some parameters to pre-fill the subject and the body:

window.open('mailto:test@example.com?subject=subject&body=body');

Hope That Helps !
Avatar of Dave Baldwin
It looks like you are trying to use javascript in the browser to call an ASP routine on the server.  That simply isn't allowed.  You can create a link to the page with the ASP routine like <a href="SENDRMS.asp">Click Here to Send TO RM's Approve</a>.
can I get a example of the page route href
Avatar of DevoinIT

ASKER

I have created this sendmail.inc and I am including this into my asp page. I keep getting the end of statment error and I can not find what is going on. I have attached my the page I am trying to send.
You didn't attach anything.
The attached file should be sendmail.inc but it not in the list of possible upload files so I changed the extension. I have bee just trying to send a email. Please review this and let me know.
SendMail.txt
That code assumes that there will be a SMTP server to send email on the local computer.  In most cases, that is not going to be true so it won't work most of the time.
ASKER CERTIFIED SOLUTION
Avatar of devoinr
devoinr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dave
You were right about the SMTP I have it working right now.
Thanks
I awarded the points to Dave
This was a good responds