Jul 29, 2007 - 6:08 PM
|
|
|
Enthusiast ![]() Joined Aug 16, '06 From Sandpoint, Idaho Currently Offline Reputation: 0 (0%) |
I'm piecing together a script to send text messages from one of my sites to my cell phone. I got it all work'd out all fine and It sends the message fine but the 'from address' is defined as anonymous@myserver.com when I'd like to have it as either...
1) I'd prefer to have it as the email address that the person fills out on the form that texts me OR 2)nobody@mydomain.com the current script is.. CODE <?php
$to="##########@vtext.com, myemail@mydomain.com"; $sucessURL="http://www.mydomain.com/success"; $failureURL="http://www.mydomain.com/error"; $subject="sitetxt"; $msg = "Name: {$_POST['txtName']}\nPhone: {$_POST['txtNumber']}\nEmail: {$_POST['txtEmail']}\nMessage: ".nl2br($_POST['txtMessage'])." "; $headers = "From: {$_POST['txtEmail']}"; if(mail($to, $subject, $msg, $headers)) { header("Location: $sucessURL"); } else { header("Location: $failureURL"); } ?> -------------------- |
![]() |
Oct 9, 2007 - 1:53 AM
|
|
|
Enthusiast ![]() Joined Aug 16, '06 From Sandpoint, Idaho Currently Offline Reputation: 0 (0%) |
Thought I would update this as I decided to work on this a little bit today and finally got it (not the time of the original post)
What I did... In a custom php.ini file located in the same folder as the script (it wouldn't work if placed anywhere else but here), not sure if the sendmail_from does anything as it didn't seem to change until I added the /usr/lib/sendmail (which is different depending on your server) CODE sendmail_from = email@domain.com sendmail_path = "/usr/lib/sendmail -t -i -f email@domain.com" This seemed to work but if you have the same script numerous times and want to have the "from" email to be unique and display as the person who filled out the form you would have to do this... This is what I was wanting from the very 1st post. Edit'd the original mail() function to say... CODE if(mail($to, $subject, $msg, $headers, "-f{$_POST['txtEmail']}")) That did it for me, now on to another question, look for another post made by me... -------------------- |
maxaud php sms message sending script, help please Jul 29, 2007 - 6:08 PM
BloodyStupidDavey That should work. Make sure your form has a txtEm... Jul 30, 2007 - 2:28 AM
maxaud thanks for the input, I will try that and see if a... Jul 30, 2007 - 3:53 AM
maxaud that didn't seem to help, I'm still gettin... Jul 31, 2007 - 1:16 AM
maxaud small update. I got it to work correctly when sent... Jul 31, 2007 - 1:45 PM![]() ![]() |
| Lo-Fi Version | Time is now: November 21st, 2025 - 3:18 AM |