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

  • Home
  • SEARCH
  • 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 8486213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:53:00+00:00 2026-06-10T20:53:00+00:00

Whenever I send a mail via PHP (content generated by jQuery, AJAX POST to

  • 0

Whenever I send a mail via PHP (content generated by jQuery, AJAX POST to PHP) the base of the URL gets missing when arriving at the destination.

So for instance, I send a mail with the following body:

Click <a href="http://www.example.com/?u=parameter&i=otherparameter">HERE</a> to go to the login page, etc, etc..

Use this link or copy it to your browser's address bar if the above doesn't work:
<a href="http://www.example.com/?u=parameter&i=otherparameter">http://www.example.com/?u=parameter&i=otherparameter</a>

Which looks like this:

Click HERE to go to the login page, etc, etc..

Use this link or copy it to your browser’s address bar if the above doesn’t work:
http://www.example.com/?u=parameter&i=otherparameter

But, the receiver gets the same text, only without the links’ base URL..

The link of Click HERE has the URL of only /?u=parameter&i=otherparameter, same goes for the other link, but the text of that link is fine. So it goes to the page where the mail is opened and appends the parameters there. It looks like this:

Click HERE to go to the login page, etc, etc..

Use this link or copy it to your browser’s address bar if the above doesn’t work:
http://www.example.com/?u=parameter&i=otherparameter

As you can see, the link will be directed to stackoverflow.com, instead of example.com. What is happening that either jQuery, AJAX or PHP strips my HTML, or is it a clientside problem?

(Tested in FF15/Chrome20/IE8, jQuery v1.7.2, PHP v5.3.5)


EDIT

This is how I send the mail with PHP:

$to      = $_POST['t'];
$subject = $_POST['s'];
$message = $_POST['m'];

$headers = "MIME-Version: 1.0" . "\r\n" . 
           "Content-type: text/html; charset=iso-8859-1" . "\r\n" . 
           "From: <noreply@example.com>" . "\r\n" .
           "X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers);
  • 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-10T20:53:01+00:00Added an answer on June 10, 2026 at 8:53 pm

    a quick solution is to use the define the base url with the _SERVER global array read documentation at php manual for more.but the mail function should not fail…
    Also where does AJAX come in in the posting of mails… that’s php mail() function.Are you retrieving values from users or are the values dynamically retrieved using the php or a database….

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

Sidebar

Related Questions

I can't seem to send any mail using PHP's mail() function whenever I specify
Whenever I use PHP to send emails to members of my site, the email
I just need to send a mail notification whenever a model is deleted. I
I need to read the gnome-shell notifications to send an e-mail whenever event X
My requirement is to send automatic mail whenever the exception arises public Connection dbConnect(String
I'd like Hudson to send an e-mail to developers whenever a warning is encountered
I've got my Rails (2.1) app setup to send email via Gmail, however whenever
whenever i send a form hidden field to paypal with an email as a
I want to send a message whenever RabbitMQ creates or deletes a queue, exchange
I want to send gps cordinates to a web service whenever the gps position

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.