LinuxQuestions.org
Visit Jeremy's Blog.
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, 10:37 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: Chicago
Distribution: CentOS
Posts: 1,277

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-12-2005, 12:21 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,143

Rep: Reputation: 322Reputation: 322Reputation: 322Reputation: 322
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, 03:49 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
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 07:11 PM
Sending mail from shell: how to define custom headers? ricky_ds Linux - Software 3 06-22-2005 08:58 AM
Sending email with PHP jacksmash Programming 7 03-10-2004 06:10 PM
sending an email to a email address after a perl operation meluser Programming 9 04-07-2003 02:26 PM
email headers.... magyartoth Linux - Security 2 05-01-2002 02:52 PM


All times are GMT -5. The time now is 08:48 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