problem, mail() send only to gmail T_T

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fishown
Forum Commoner
Posts: 33
Joined: Sat May 12, 2007 5:35 pm

problem, mail() send only to gmail T_T

Post by fishown »

Hello every one , =]

General:
Im runing my own box, so if ther is some php.ini stuff I can change them.
running centos 5.5 dovecot squirrelmail.

So as the topic says, when i try to use the mail() function it returns TRUE every time ,
but I recive the mail only if im sending to an Gmail account.

NOTE: If im trying to send mail from Squirrelmail , I recive the mail perfectly in evey mail account.

Please, I cant find the answer =\
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: problem, mail() send only to gmail T_T

Post by Jonah Bron »

The only reason it would behave differently across email providers that I know of would be spam filtering. Check your local and remote spam boxes.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: problem, mail() send only to gmail T_T

Post by josh »

Post the raw email received at gmail and also a screenshot of a telnet session to your local mail server, also ask the server administrator to check the error logs for the MTA to see if a bounce is occurring, or if the remote servers are sending back an error.

Once I see your raw email & telnet session I can suggest some things possibly, like the EHLO value.

Also run reverse hostname lookup on the IP that this host pings to, make sure all values agree with each other. Make sure they're not in the SBL blocklist
fishown
Forum Commoner
Posts: 33
Joined: Sat May 12, 2007 5:35 pm

Re: problem, mail() send only to gmail T_T

Post by fishown »

First of all thank you for your reply,
Checkd the spam folder, nothing ther.

and josh, what do you mean by "raw email" and how to i see the telnet session?
and im the server administrator
and asme whithe revers hostname look up , im kinda new =\ please explain.

thank you =].
josh wrote:Post the raw email received at gmail and also a screenshot of a telnet session to your local mail server, also ask the server administrator to check the error logs for the MTA to see if a bounce is occurring, or if the remote servers are sending back an error.

Once I see your raw email & telnet session I can suggest some things possibly, like the EHLO value.

Also run reverse hostname lookup on the IP that this host pings to, make sure all values agree with each other. Make sure they're not in the SBL blocklist
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: problem, mail() send only to gmail T_T

Post by Pazuzu156 »

I'm not much into squirlmail. I'd recommend Roundcube as it's so much easier to work with.

I made a simple e-mailer with the main() function, sort of like this:

Code: Select all

<?php

if(isset($_REQUEST['submit'])) {
	$email = $_REQUEST['email'];
	$recipient = $_REQUEST['recipient'];
	$subject = $_REQUEST['subject'];
	$message = $_REQUEST['message'];
	
	if($email&&$recipient&&$subject&&$message) {
		mail("$recipient","Subject: $subject", $message, "From: $email");
		echo "
		<div id='container'>
<form action='index.php=submit?".md5("submit")."' method='POST'>
<table id='webmail_table'>
	<tr>
		<td colspan='2' id='webmail_table_title'><span id='send'>Sending, please wait...</span><meta http-equiv='refresh' content='4;url=webmail_sent.php?webmail_id=".md5("sending_mail")."'></td>
	</tr>
	<tr>
		<td>E-Mail: </td>
		<td><input type='text' size='51' name='email' placeholder='Your E-Mail' /></td>
	</tr>
	<tr>
		<td>Recipient: </td>
		<td><input type='text' size='51' name='recipient' placeholder='Recipients E-Mail' /></td>
	</tr>
	<tr>
		<td>Subject: </td>
		<td><input type='text' size='51' name='subject' placeholder='Message Subject' /></td>
	</tr>
	<tr>
		<td>Message: </td>
		<td><textarea cols='40' rows='6' name='message' placeholder='Message'></textarea></td>
	</tr>
	<tr>
		<td><input type='submit' name='submit' value='Send' /></td>
		<td><input type='reset' value='Reset Form' /></td>
	</tr>
</table>
</form>
</div>
		";
	} else {
		echo "
		<div id='container'>
<form action='index.php' method='POST'>
<table id='webmail_table'>
	<tr>
		<td colspan='2' id='webmail_table_title'><span id='send'>Please fill out the entire form, thanks.</span><meta http-equiv='refresh' content='2;url=index.php'></td>
	</tr>
	<tr>
		<td>E-Mail: </td>
		<td><input type='text' size='51' name='email' placeholder='Your E-Mail' /></td>
	</tr>
	<tr>
		<td>Recipient: </td>
		<td><input type='text' size='51' name='recipient' placeholder='Recipients E-Mail' /></td>
	</tr>
	<tr>
		<td>Subject: </td>
		<td><input type='text' size='51' name='subject' placeholder='Message Subject' /></td>
	</tr>
	<tr>
		<td>Message: </td>
		<td><textarea cols='40' rows='6' name='message' placeholder='Message'></textarea></td>
	</tr>
	<tr>
		<td><input type='submit' name='submit' value='Send' /></td>
		<td><input type='reset' value='Reset Form' /></td>
	</tr>
</table>
</form>
</div>";
	}
} else {
	echo "<div id='container'>
<form action='index.php' method='POST'>
<table id='webmail_table'>
	<tr>
		<td colspan='2' id='webmail_table_title'>Form</td>
	</tr>
	<tr>
		<td>E-Mail: </td>
		<td><input type='text' size='51' name='email' placeholder='Your E-Mail' /></td>
	</tr>
	<tr>
		<td>Recipient: </td>
		<td><input type='text' size='51' name='recipient' placeholder='Recipients E-Mail' /></td>
	</tr>
	<tr>
		<td>Subject: </td>
		<td><input type='text' size='51' name='subject' placeholder='Message Subject' /></td>
	</tr>
	<tr>
		<td>Message: </td>
		<td><textarea cols='40' rows='6' name='message' placeholder='Message'></textarea></td>
	</tr>
	<tr>
		<td><input type='submit' name='submit' value='Send' /></td>
		<td><input type='reset' value='Reset Form' /></td>
	</tr>
</table>
</form>
</div>";
}

?>
Where mail(); is:

Code: Select all

mail("$recipient","Subject: $subject", $message, "From: $email");
Try that see if it helps.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
fishown
Forum Commoner
Posts: 33
Joined: Sat May 12, 2007 5:35 pm

Re: problem, mail() send only to gmail T_T

Post by fishown »

Hellow guys , found the answer my self T_T...

The problem was that when I installed the Dovecot (SMTP server for linux) my hostname what deffrend then now ...
So i edited the config file to mach the current host name, and it seems so slove the problem.

thank you very much =]
User avatar
Pazuzu156
Forum Contributor
Posts: 241
Joined: Sat Nov 20, 2010 9:00 pm
Location: GA, USA
Contact:

Re: problem, mail() send only to gmail T_T

Post by Pazuzu156 »

Glad you solved the problem.
- Kaleb Klein
------------------------------------
Web Developer | Software Developer
https://kalebklein.com
PGP Key: https://keybase.io/pazuzu156
Post Reply