using PHP mail()...Blank Messages

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
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

using PHP mail()...Blank Messages

Post by kendall »

Hi,

I am using PHP's mail() to send a "simple email" to an email address

a minute ago the following email message was outputted
================================================<br>{email removed}<br>Feedback Form<br>
--fda663d909b7084f9d2ad6cb4cb0e92b-xxx--
Content-Type: text/plain; charset='iso-8859-1'
Content-Transfer-Encoding: 8bit
The following was submitted on Wed, 21 May 2008 12:44:20 -0700:
first_name: Kendall
last_name: Arneaud
email_address: {email removed}
phone: 9999999
comments: orem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.


--fda663d909b7084f9d2ad6cb4cb0e92b-xxx--
Content-Type: text/html; charset='iso-8859-1'
Content-Transfer-Encoding: 8bit
The following was submitted on Wed, 21 May 2008 12:44:20 -0700:<br/>first_name: Kendall<br/>last_name: Arneaud<br/>email_address: {email removed}<br/>phone: 9999999<br/>comments: orem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.<br/>

--fda663d909b7084f9d2ad6cb4cb0e92b-xxx----
<br>MIME-Version: 1.0
To: Youth Business Trinidad and Tobago <{email removed}>
From: Kendall <{email removed}>
Reply-To: <{email removed}>
Bcc: <{email removed}>
Content-Type: multipart/alternative; boundary="fda663d909b7084f9d2ad6cb4cb0e92b-xxx--"
<br>
As you can see I have made up the message to support plain text and html...

My problem is that the above email body is BLANK in my inbox right now even thought the above is what was sent to me via email.

The thing is...If i flooded the form text area that sumitting this information with alot of text....I would get part of the message in the body of the email

Whats even wierd about this is that I am using this same script for another form which so happens to have alot more information to send and i get the body of the message

So .....what in blue sam hills is going on here? :banghead: :crazy:
Last edited by kendall on Wed May 21, 2008 4:34 pm, edited 1 time in total.
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: using PHP mail()...Blank Messages

Post by Jade »

Are you sending the text in the body or in the additional parameters?

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: using PHP mail()...Blank Messages

Post by kendall »

Jade wrote:Are you sending the text in the body or in the additional parameters?

bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] )
the $message
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: using PHP mail()...Blank Messages

Post by Jade »

I might be wrong but I think you have to send the header data in the additional fields and the message in just the body of the message. Have you tried stripping it down to something like:

Code: Select all

 
mail('test@gmail.com', 'test email', $text_body_no_headers, "From: myname@gmail.com");
 
If that goes through without an issue then I would say its one of two things:

1) something wrong with your headers

2) something wrong with your php.ini mailer settings
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: using PHP mail()...Blank Messages

Post by kendall »

Well the thing about this is

i have 2 form applications going through the same process...Why would one work but the other would not....

Worst...Why would the one that wasnt working ...work when the text contains more than 150 characters? :dubious: :banghead: :crazy:

I will try your scenarios though

Kendall
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: using PHP mail()...Blank Messages

Post by Jade »

Are you using any irregular characters? Are you stripslashing the message before you pass it in? It could be you're not putting in the escape character and that's causing the mail to fail.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Re: using PHP mail()...Blank Messages

Post by kendall »

Jade wrote:Are you using any irregular characters? Are you stripslashing the message before you pass it in? It could be you're not putting in the escape character and that's causing the mail to fail.
Well i am stripping the messaage of html tags for the plain text area...replacing them with \n and \r...

what i had posted was the actually text going into the $message for the mail()

and the headers (last part) going into the $headers...
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: using PHP mail()...Blank Messages

Post by Benjamin »

It may be worth your while to just use swiftmailer.
Post Reply