School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 358,291 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,471 people online right now.Registration is fast and FREE... Join Now!



mail function sends to junk mail

52 Weeks of Code Challenge: Android

Week #11 of the 52 Weeks of Code Challenge is Android, you should give it a shot. Click Here!

mail function sends to junk mail how to avoid Rate Topic: -----

#1 tork  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 14-December 06


Dream Kudos: 0

Post icon  Posted 20 December 2006 - 02:10 PM

I have the following code that emails to a hotmail user:

$subject = "Email Subject";

$header = "From: Some Person<email@somewhere.com>\r\n" .
'Reply-To: Some Person <email@somewhere.com>' . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: ­ 8bit\r\n\r\n"; 

$message = "Email Message";

$sendmail = mail("user@hotmail.com",$subject,$message,$header);



This mail function sends emails to the hotmail user, but straight to hotmail's junk mail function. I have read that only html files will work, so I changed content-type from 'text/html' to 'html'. this seems wrong as it has attached a file to the email, which is most likely the email message. Also, I have read that "\r\n" may be a problem, so i changed it to "\n", still no results. All of these changes have not worked. So how do I avoid the dreaded junk mail function of email servers? yahoo and gmail works fine and my domain name is not blacklisted.
Was This Post Helpful? 0
  • +
  • -


#2 snoj  Icon User is offline

  • Married Life
  • Icon

Reputation: 42
  • View blog
  • Posts: 3,475
  • Joined: 31-March 03


Dream Kudos: 775

Re: mail function sends to junk mail

Posted 20 December 2006 - 02:33 PM

Email is marked as spam because of where it comes from or from the content that it contains.

Off the top of my head I'd guess that either it's seeing the X-mailer thing or the content you're sending in the email.
Was This Post Helpful? 0
  • +
  • -

#3 tork  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 14-December 06


Dream Kudos: 0

Re: mail function sends to junk mail

Posted 21 December 2006 - 08:00 PM

how do I state the x Mailer, say if I make it as sent from Outlook or something like that. and how do I change the content type? is it text/html? or text\html? at the moment my message is sent as an attachment, which is not suitable for my needs...
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • Icon

Reputation: 42
  • View blog
  • Posts: 3,475
  • Joined: 31-March 03


Dream Kudos: 775

Re: mail function sends to junk mail

Posted 21 December 2006 - 08:51 PM

Well the SMTP says that messages should use CR+LF (\r+\n) to specify new lines.

Did you even read your code? The X-Mailer flag is right there.

"text/html" is the proper way to state the html mime type in the Content-type flag.
Was This Post Helpful? 0
  • +
  • -

#5 cipherence  Icon User is offline

  • D.I.C Regular
  • Icon

Reputation: 1
  • View blog
  • Posts: 260
  • Joined: 01-April 06


Dream Kudos: 650

Re: mail function sends to junk mail

Posted 23 December 2006 - 03:08 PM

some times smtp servers will also forward emails to junk mail because the sender , (the one logged into smtp server) isn't Registered for that server.
Was This Post Helpful? 0
  • +
  • -

#6 tork  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 14-December 06


Dream Kudos: 0

Re: mail function sends to junk mail

Posted 26 December 2006 - 08:54 PM

I am still unable to send email's to a hotmail account. I have contacted hotmail and still awaiting a reply to see whether it has something to do with their end, but I dont think it would. My code is now this:

$subject = "Email Subject";

$header = "From: Some Person<email@somewhere.com>\r\n" .
'Reply-To: Some Person <email@somewhere.com>' . "\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: 8bit\r\n\r\n";

$message = "Email Message<br />
<br />
Regards,
<br />
Tork< br/>";

$sendmail = mail("user@hotmail.com",$subject,$message,$header);



I am stuck, so stuck it's not funny! ARGH! :blink:
Was This Post Helpful? 0
  • +
  • -

#7 Dark_Nexus  Icon User is offline

  • or something bad...real bad.
  • Icon

Reputation: 94
  • View blog
  • Posts: 1,646
  • Joined: 02-May 04


Dream Kudos: 725

Re: mail function sends to junk mail

Posted 26 December 2006 - 10:52 PM

$header = "From: Some Person<email@somewhere.com>\r\n" .
'Reply-To: Some Person <email@somewhere.com>' . "\r\n" .


is bogus, and the server knows it, that's why it's getting trashed. change it up.

Quote

Email is marked as spam because of where it comes from or from the content that it contains.


Quote

some times smtp servers will also forward emails to junk mail because the sender

Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month