Page 1 of 1

send email

Posted: Fri Mar 15, 2013 11:10 am
by roice
Hello,

strange thing with my email code - I tried to send an email with form but sometime its successed and sometime it's not
if I change the TO filed it works (sometimes).
I thought that maybe GOOGLE block the server adress so I upload the same code to another server, but same thing happened...

here is the code:

Code: Select all

				$message = "";
				$subject = "email from website";
				$date  = mktime(date("H"), date("i"), date("s"), date("m")  , date("d"), date("Y"));
				$date = date("d.m.Y", $date);
				$siteName = "my-website.com";
				$from = "MIME-Version: 1.0 \r\n";
				$from .= "From: $site_email \r\n";
				$site_email = "some-email@gmail.com‏";
				$message = " 
				$date 
				Site name $siteName
				name: $name
				phone: $phone
				email: $email
				text: $text
				";
				
				if (mail($site_email, $subject, $message, $from)); 			
					echo "<div class='msg msg_approve'>success</div>";

I tried to send the email to number of emails address but it did worked...
What do I do wrong?

Re: send email

Posted: Fri Mar 15, 2013 1:14 pm
by requinix
Email is more complicated nowadays then simply about sending something from one person to another. I strongly suggest you use a library like SwiftMailer or PHPMailer. Both of them are more knowledgeable about how to send proper emails that are much less likely to be rejected by spam filters.

Re: send email

Posted: Sun Mar 17, 2013 1:22 pm
by roice
do you have some code for example that use SwiftMailer or PHPMailer?

Re: send email

Posted: Sun Mar 17, 2013 10:06 pm
by requinix
Not myself no, but Google does.