Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-07-2008, 02:59 AM   #1 (permalink)
@script
Recruit
 
Join Date: May 2008
Posts: 19
@script is on a distinguished road
mailing problem

Hi everybody,

I have wrote a php script to send a mail. It works fine with the mail id's of google,yahoo,rediff,... but it is not working for mail id of my company. Code reads as follows:
<?php
$to = 'maheshkumar.davuluri@bipsum.com';
$subject = $_POST['txtSub'];
$name = $_POST['txtName'];
$com = $_POST['txtCom'];
$email= $_POST['txtEmail'];
$city = $_POST['txtCity'];
$con = $_POST['txtContry'];
$ph1 = $_POST['txtPh1'];
$ph2 = $_POST['txtPh2'];
$comm = $_POST['txtAr'];
$message = "---------------------------\n".
"----Sender's detail's------\n".
"Name of the Sender : $name\n".
"Company Name : $com\n".
"Email Id is : $email\n".
"City : $city\n".
"Country : $con\n".
"Contact number : code-$ph1 , number-$ph2\n".
"-----Comment's------------\n".
"$comm\n".
"--------------------------\n";
mail($to,$subject,$message,$headers);
header("Location:http://www.bipsum.com/thankyou.html");
exit;?>


i'm wondering for so many days why it is not working. Any help is appreciated.

thanks in advance.
@script is offline   Reply With Quote
Old 05-07-2008, 03:11 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,139
Belisarius is on a distinguished road
You don't define '$headers' in the code snippet you posted. Your company's e-mail server might not accept mail unless the 'From' field (which is defined in '$headers') is filled out.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-07-2008, 09:42 PM   #3 (permalink)
@script
Recruit
 
Join Date: May 2008
Posts: 19
@script is on a distinguished road
Re: mailing problem

hi,

i still cant get the email even mail is going porperly. any suggestions please.

thanks
@script is offline   Reply With Quote
Old 05-08-2008, 01:54 AM   #4 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,139
Belisarius is on a distinguished road
Quote:
Thanks for your reply. I have tried with the following code with the corrections that you have suggested:

<?php
$to = 'maheshkumar.davuluri@bipsum.com';
$subject = $_POST['txtSub'];
$name = $_POST['txtName'];
$com = $_POST['txtCom'];
$email= $_POST['txtEmail'];
$city = $_POST['txtCity'];
$con = $_POST['txtContry'];
$ph1 = $_POST['txtPh1'];
$ph2 = $_POST['txtPh2'];
$comm = $_POST['txtAr'];
$headers = "From: maheshkumar.davuluri@gmail.com\r\n";
$message = "---------------------------\n".
"----Sender's detail's------\n".
"Name of the Sender : $name\n".
"Company Name : $com\n".
"Email Id is : $email\n".
"City : $city\n".
"Country : $con\n".
"Contact number : code-$ph1 , number-$ph2\n".
"-----Comment's------------\n".
"$comm\n".
"--------------------------\n";
mail($to,$subject,$message,$headers);
header("Location:http://www.bipsum.com/thankyou.html");
exit;?>

now mail delivery is fine but it is not appearing in the inbox at the destination. Please help me in this regard

thanks
How do you know that delivery works if it's not showing up in your inbox?
Are you sure you're sending it to the correct address?

P.S. - Please keep the conversation in the forums.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 05-08-2008, 03:06 AM   #5 (permalink)
@script
Recruit
 
Join Date: May 2008
Posts: 19
@script is on a distinguished road
thak you url that i have place in the header location is loading successfully, and also i have checked it by assigning a variable. like checking weather it returns true or false. coz mail() returns a boolean value. If there is any alternative please suggest me if not this porgraming.

thanks
@script is offline   Reply With Quote
Old 05-08-2008, 08:57 AM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
are you saying it's not able to send email to your company, but it is working for other email addresses? if so, it's probably triggering a spam filter on your company's mail server.
__________________
Mike
sde is offline   Reply With Quote
Old 05-08-2008, 11:47 PM   #7 (permalink)
@script
Recruit
 
Join Date: May 2008
Posts: 19
@script is on a distinguished road
actually the problem is that it is neither going in to inbox nor appearing in the spam of my company email-id. please any one specify me another programing alternative in php if it is not the right one.
@script is offline   Reply With Quote
Old 05-09-2008, 08:51 AM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
ok, have you verified your php.ini file is pointing to the proper mail executable or mail server? the area in the file looks like this, but you would need to un-comment one of the lines and set the value depending on your os and mail method
Code:
[mail function]
; For Win32 only.
;SMTP =

; For Win32 only.
;sendmail_from =

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "sendmail -t -i"
__________________
Mike
sde is offline   Reply With Quote
Old 05-09-2008, 11:17 PM   #9 (permalink)
@script
Recruit
 
Join Date: May 2008
Posts: 19
@script is on a distinguished road
mailing problem

hi sde and every body,

i have to upload the code to 'ftp' from there i need to monitor the transaction of the mail. Therefore i think there is no need to worry about the php.ini file. If any body want to check php of my company server go to this link: phpinfo()

thanks
@script is offline   Reply With Quote
Old 05-09-2008, 11:44 PM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
try to simplify your script. here's a sample taken from php.net. if this doesn't work for you, i don't know how to help.
PHP Code:
<?php
mail
('caffinated@example.com''My Subject'$message);
PHP: mail - Manual
__________________
Mike
sde is offline   Reply With Quote
Old 05-10-2008, 12:57 AM   #11 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,444
sde is on a distinguished road
also, please refrain from contacting me outside this thread. i get notifications when it updates. thanks.
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A small problem in the output the_master Standard C, C++ 1 12-17-2006 09:09 AM
parse error problem in game.. can't seem to find problem solution. slashdot Standard C, C++ 5 08-03-2005 08:15 PM
Hashing problem jodders Standard C, C++ 1 02-09-2005 01:51 PM
Problem Assignment (Urgent help req.) Boltress Standard C, C++ 0 01-12-2005 07:59 AM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 04:44 PM


All times are GMT -8. The time now is 04:38 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting