Web Hosting Forum | Lunarpages
News: July 14, 2008 - New Contest! - Submit Your WordPress Theme Designs, Win BIG!
August 5, 2008 - Time to Submit Your Links for the August 08 Site of the Month Award!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 21, 2008, 02:37:31 AM


Login with username, password and session length


Pages: [1]   Go Down
  Print  
Author Topic: mail() function and the "From" setting  (Read 657 times)
RandyT
Global Moderator
Über Jedi
*****
Offline Offline

Posts: 2556


Amy's Personal Assistant


« on: January 03, 2007, 06:01:55 PM »

Sorry for the missing post, but there were two identical threads and somehow when I removed one they both disappeared !  Surprised My apologies ! I am putting the posts back here as best i can:

jzimmerlin wrote:

 
Quote
I'm making a PHP script that sends emails to cell phones using the mail() function.  Even though I've set the "From" header and tried using ini_set() to change the "sendmail_from" value, the text message on the cell phone says its from "username@circini.lunarpages.com".

Here is the code I'm using, more or less..

ini_set(sendmail_from, "newsupdates@jeffzimmerlin.com");

$Header="From: newsupdates@jeffzimmerlin.com\r\n";

mail("$EmailAddress", "Subject", "Body", $Header);

Any ideas?

Jeff


kthaman replied:

 
Quote
I'm having that issue to. I am using the phpmailer script to send. The from line shows what I've said, but if you look at the headers, it shows the my account's username@lunarpages.  I'd love to prevent that as well.

I think it is because it is a php script that is sending the mail instead of it being sent via smtp.  Hopefully someone can answer the question.

kthaman replied again:

Quote
OK, I just found a way to edit the return-path in phpmailer.

Maybe the phpmailer script would be an alternative for you?
Logged

Randy T.
kthaman
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« Reply #1 on: January 03, 2007, 07:20:02 PM »

Well, phpMailer has a variable to set the return-path but it isn't working. And looking at the code for it, if there isn't a sender variable set, it should default to the from variable.  Since this isn't working properly, I'm wondering if it has something to do with the way LunarPages sends out the mail?  (Basically the code is doing the same thing yours is - setting the header.)

So is Lunarpages rejecting those header changes?

Also, I did try setting the sendmail_from in the php.ini, but that didn't help either.
Logged
jzimmerlin
Spacescooter Operator
*****
Offline Offline

Posts: 44


« Reply #2 on: January 04, 2007, 02:14:49 PM »

The odd thing is that mail sent to my Yahoo! mail account using the PHP function mail() works perfect.  The sender e-mail address is the e-mail address set using the header variable.  However, the same e-mail sent to a cell phone has the username@circini.lunarpages.com sender address.
Logged
kthaman
Pong! (the videogame) Master
*****
Offline Offline

Posts: 29


« Reply #3 on: January 05, 2007, 01:05:03 PM »

My problem was solved by removing the safemode line in my php.ini.  I doubt you have that issue since the email portion worked, but maybe there is another setting that isn't obvious that is keeping the phone portion from working.
Logged
jzimmerlin
Spacescooter Operator
*****
Offline Offline

Posts: 44


« Reply #4 on: January 05, 2007, 01:54:39 PM »

I added a 5th parameter to the mail() function, and it solved the problem.

Example:

<?php
mail('nobody@example.com', 'the subject', 'the message', null, '-fwebmaster@example.com');
?>
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM