Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8895587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:49:08+00:00 2026-06-14T23:49:08+00:00

I currently have some JavaScript code that calls a .php file to send me

  • 0

I currently have some JavaScript code that calls a .php file to send me an email from within a .jsp using an on-click function. It also includes a couple of variables, see below.

<script>
function sendMail(video, user) {
var xmlhttp;
     if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
     } else {// IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
     }
     xmlhttp.open("GET", "http://www.mydomain.com/sendemail.php?video="+video+"&user="+user+'&ip=<%= request.getHeader("X-Real-IP") %>', false);
     xmlhttp.send();
}
</script>

Calling the script within a .jsp file:

            <a href="${videoUrl}" target="main" onclick="sendMail(parentElement.parentElement.getElementsByTagName('span')[2].attributes['title'].value, '${model.user.username}')">

Now I have a .py (different application than above) file that I would like to call this sendMail function. Section where I want to call the sendMail function in the .py file

def play(self, song_id):
    Addon.log('play: ' + song_id)
    if Addon.get_setting('transcode') == 'true':
        bitrate = self.bitrates[int(Addon.get_setting('bitrate'))]
        Addon.resolve_url(self.build_rest_url('stream.view', 
                                              {'id': song_id,
                                               'maxBitRate': bitrate}))
    else:
        Addon.resolve_url(self.build_rest_url('download.view', 
                                              {'id': song_id}))

Now is there anyway to accomplish this sendMail function but from within a python file? Instead of using the function can I call a URL?

I Frankenstein a webapp I’m running to email me notifications, easiest way I found was to create the JavaScript function and then call some PHP to send an email. Now the python is a different app all together, just trying to figure out how to do the same thing, call the URL to send an email but with Python.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:49:10+00:00Added an answer on June 14, 2026 at 11:49 pm

    To call a url try the urllib2 module eg:

    >>> import urllib2
    >>> f = urllib2.urlopen('http://www.python.org/')
    >>> print f.read(100)
    

    To send email try the email module starting with any of these examples.

    To launch an external process on the same machine (eg the php script) try the SubProcess module

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Zend_Search_Lucene, the PHP port of Java Lucene. I currently have some code
I'm currently refactoring some Javascript code we have and amongst other things I've changed
I have some code which I'm currently using to change the static-IP of a
I have some python code that currently performs expensive computation by performing the computation
I have some code that currently checks for minimum and maximum lentgh. I want
I currently have an application that calls creates and displays charts from various objects'
I'm working from some sample code, provided in PHP - we are using c#,
I'm struggling with some JavaScript code that I have used countless times across my
I currently have some code which when you press the submit button, a marker
We have some stuff that may be exported into various formats. Currently we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.