Reputation: 975
I was trying to shoot mail through php coding. but its showing error "SMTP error, 550 Sender is not allowed", Is it a server problem or is there is any problem in coding?
But when I am sending mail directly through my cpanel, its getting delivered.
Code I am using to send mails is:
<?php
$to = "[email protected]";
$subject = "HTML email";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
mail($to,$subject,$message,$headers);
?>
Upvotes: 3
Views: 8843
Reputation: 975
Thanks a lot guys for your help.
Actually it figured out to be problem from my server side. My mails were blocked by my server.
Upvotes: 0
Reputation: 31
Usually this means that the receiving server is rejecting the message because the FROM domain and the domain of the sending SMTP server do not match (e.g. example.in is not the same domain that your server is saying that it is a part of).
Upvotes: 3