ajax and php mail() function

Page 1 of 1

1 Replies - 2350 Views - Last Post: 20 April 2012 - 01:40 PM

#1 Asperant  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 05-November 11

ajax and php mail() function

Posted 20 April 2012 - 10:49 AM

There is a simple php-script:

<?php
  $email = "shift.mail@yandex.ru";
  $headers = "From: ".$_SERVER['SERVER_NAME']." <'no_reply@***.info'>\r\n";
  $headers = $headers."Content-type: text/html; charset=\"utf-8\"\r\n";
  $headers = $headers."Return-path: <'no_reply@***.info'>\r\n";
  $message = '<p>e-mail notify<p>';
  $subject = 'e-mail notify';
  $res =   mail( $email, $subject, $message, $headers );
?>


I need it for e-mail notify of my site. If I use it by url-field of my browser - it works fine (e-mail is sent). But if I try to use it by AJAX request, nothing works:
$.ajax({
        url: "email_notify.php",
    });


Also, I tried to use $.getJSON, $.post etc.

Could someone tell me, what is wrong with my code?

Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: ajax and php mail() function

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5669
  • View blog
  • Posts: 22,517
  • Joined: 23-August 08

Re: ajax and php mail() function

Posted 20 April 2012 - 01:40 PM

Closed. Please do not cross-post across forums.

Other topic
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1