...

View Full Version : Sending Email with PHP



thekevin07
02-28-2007, 05:55 PM
HI

I tried sending mail with php's mail function and i filled in the From: option in for the header but when ever i send an email to gmail and im assuming other webbased email its blocked by the email or is put in the spam folder does anyone know how to make it so emails are sent to the inbox? Im assuming i am missing something in the header option


Thanks

ArcticFox
02-28-2007, 06:11 PM
Let's see your code. :)

thekevin07
02-28-2007, 06:17 PM
Heres my code:




$to = "johndoe@gmail.com";
$subject = "PHP Is Great";
$body = "PHP is one of the best scripting languages around";
$headers = "From: johndoe@example.com\n";
mail($to,$subject,$body,$headers);
echo "Mail sent to $to";

rafiki
02-28-2007, 07:19 PM
use if statements to see if the mail sent!




$to = "johndoe@gmail.com";
$subject = "PHP Is Great";
$body = "PHP is one of the best scripting languages around";
$headers = "From: johndoe@example.com\n";
mail($to,$subject,$body,$headers);
if (mail($to,$subject,$body,$headers))
{
echo "Mail sent to $to";
}
else
{
echo "Sorry Server Error";
}

aedrin
02-28-2007, 07:22 PM
I think the problem is that emails are getting marked as spam.

If you google for this I think there's quite a bit of information.

One of the key things that a spam filter will look at is the headers. There's a few headers in there that will ensure a higher chance of it going to the inbox.

Besides that this is just a result from people getting upset about spam.

You just need to tell people they have to add your email address to the allowed list.

rafiki
02-28-2007, 07:28 PM
I think the problem is that emails are getting marked as spam.

If you google for this I think there's quite a bit of information.

One of the key things that a spam filter will look at is the headers. There's a few headers in there that will ensure a higher chance of it going to the inbox.

Besides that this is just a result from people getting upset about spam.

You just need to tell people they have to add your email address to the allowed list.

Correct!
But first is the mail being sent? if not its a server error :)

thekevin07
02-28-2007, 07:34 PM
Yes the emails are being sent but they are forwarded to the spam folder on the person of the recieving end and could you give a few link suggestions or usefull keywords to type in google im stuck :confused:

CFMaBiSmAd
02-28-2007, 07:57 PM
Here is a recent thread that covers most of the common things you need to get right in order for an email to not be automatically ranked as spam - http://www.codingforums.com/showthread.php?t=108140

The short version -

Check that your server and mail server "look" correct to the receiving mail server - check at www.dnsreport.com

Check if your mail server appears on spam databases - check at www.dnsstuff.com

Make sure that your email is a valid email. Does the domain in the from address exist and match your sending mail server or does the DNS server for that from domain have an SPF record that authorizes your mail server to send for it...

Make sure the content of the email does not look like spam. Short subject or message bodies with "spam" like words will be voted as spam. Spam like names in the From: address will also get votes for being spam.

This and a lot more information about how the major ISP's treat incomming email can be found at the "postmaster" web pages that they all have -

http://postmaster.aol.com/

http://postmaster.msn.com/

http://help.yahoo.com/l/us/yahoo/mail/original/abuse/index.html

thekevin07
02-28-2007, 10:45 PM
THANK YOU:D

I am using googles smtp server to send email and i dont suppose you know of a way to get a domain out of a spam list?

rafiki
03-01-2007, 12:35 AM
change subject and headers, thats a big hitter for spam filters



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum