LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 10-11-2005, 09:37 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,249

Rep: Reputation: 53
Sending email in PHP, what headers should I use?


I send out a monthly news letter to my customers via php script but many have called me saying they didnt get it or it went straight to there spam box.

What headers should I use?

I have been using just the from header.
 
Old 10-11-2005, 11:21 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,060

Rep: Reputation: 295Reputation: 295Reputation: 295
A subject would probably be a good idea too . Are you running your Web server on a home broadband or dialup connection? Many ISPs will block SMTP from these networks due to the massive amounts of virus generated spam.
 
Old 10-12-2005, 02:49 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,226

Rep: Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022
Her's what a I use (internally)
Code:
    # Declare vars
    $contact_email = ""; # contact email address
    $sender = "";        # sender of email as specified in cfg file
    $subject = "";       # subject line in email
    $body_text = "";     # actual email msg text
    $status = "";        # check val for eg mail()

    # Set the fields required by Mailer...
    $contact_email = $GLOBALS["cfg"]['ADMIN_EMAIL'];
    $sender = basename($_SERVER['PHP_SELF']);
    $subject = $sender.": Error trapped";
    $body_text = "This is an automated warning:\n\n".
                 "$error_msg\n\n".
                 "Regards,\n$sender at ".$_SERVER['SERVER_NAME']."\n\n";

    # ... and send it
    $status = mail($contact_email, $subject, $body_text, "From: ".$sender);
    if( !$status )
    {
        fwrite($GLOBALS["logfp"],"send_email(): Failed to send msg\n");
    }
in a function send_email($error_msg)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
email headers ziegen Linux - Security 1 08-24-2005 06:11 PM
Sending mail from shell: how to define custom headers? ricky_ds Linux - Software 3 06-22-2005 07:58 AM
Sending email with PHP jacksmash Programming 7 03-10-2004 05:10 PM
sending an email to a email address after a perl operation meluser Programming 9 04-07-2003 01:26 PM
email headers.... magyartoth Linux - Security 2 05-01-2002 01:52 PM


All times are GMT -5. The time now is 06:43 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration