Jump to content

Recommended Posts

Hi,

 

I need to send automated HTML emails with PHP for my web-server. I have SMTP with Postfix and Sendmail. When i send an email, it just goes to the spam folder of the mail client (tried with GMAIL as well as Microsoft outlook). Could i have the code for sending emails so they don't go to the spam folder. With full headers, etc.

 

Thanks a lot,

 

Jack

Link to comment
https://forums.phpfreaks.com/topic/258273-full-mail/
Share on other sites

Jackr, care to post the code you're using at the moment and see if we can help or point you in the right direction?

 

At the moment your post is a bit like me going to an auto-store and asking, "My car needs a new head gasket, can I have one please?"

 

Without letting them know what car model, make or year of car I drive.

Link to comment
https://forums.phpfreaks.com/topic/258273-full-mail/#findComment-1323906
Share on other sites

I'll jump the gun and bet it's the same issue I used to have. I got around it by changing the "From:" header to "mydomain@myhost.com" (the actual account sending the email) and adding a "Reply-To:" header for "someone@mydomain.com" (the address you want people to reply to)

 

If not set like this and if the originating domain "myhost.com" and the "From" header domain "mydomain.com" do not match, I imagine the spam filters will mark it as spam.

 

It should look kinda like this..

 

<?php
    $header .= "Reply-To: Some One <someone@mydomain.com>\n";
    $header .= "Return-Path: Some One <someone@mydomain.com>\n";
    $header .= "From: Some One <mydomain@myhost.com>\n";
    $header .= "Organization: My Organization\n";
    $header .= "Content-Type: text/plain\n";

    mail("to@wherever.com", "Message Subject", "This is my message.", $header);
?>

 

Edit: Fixed typo.

Link to comment
https://forums.phpfreaks.com/topic/258273-full-mail/#findComment-1323914
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.