Welcome! Log In Create A New Profile

Advanced

Task4C

Posted by Reinie 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Task4C
April 03, 2007 02:48PM
Completed

E-mail not working.

I get the following error meassage:
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\xampp\xampp\test\phpstudent\thankyou.php on line 56
Failed to send e-mail


Something to do with our local mail server? Using Novell Groupwise.
Re: Task4C
April 04, 2007 01:19PM
Completed.

E-mail working as well.
Re: Task4C
April 12, 2007 12:07PM
thumbs upTask completed.

php.ini needed some tweaking for mail to send.
Re: Task4C
April 14, 2007 04:31PM
Hi Mac,

Task completed.

I had to configure the path for sendmail to work, i.e. in the php.ini file.

Prior to that I was getting a failure as I would have expected. However I thought that the defualt config for php.ini would have initiated my Outlook client. I have now pointed php.ini mail() path to sendmail.php and the script executes successfully.

I changed $mail_to = "mackgray@mweb.co.za" within the thankyou.php script, however I have yet to receive any email even though the script executes "successfully".

How do I

(a) get the mail() ....(configure php) to use my existing Outlook client to send mail?
(b) actually receive email using my current configuration, i.e. using sendmail as I have done?

Please assist.

Thanks,

Mackgray.
Re: Task4C
April 14, 2007 09:23PM
Done
Re: Task4C
April 15, 2007 06:23PM
Completed thumbs up
Re: Task4C
April 15, 2007 06:37PM
Completed

Had to un-comment the "sendmail" option in the php.ini , as well as setup my smtp mail server (smtp.vodacom.co.za) , but after that - perfect !!

Received the email 5 seconds later too.

J smileys with beer
Re: Task4C
April 24, 2007 11:27AM
task completed successfully
Re: Task4C
April 28, 2007 08:30PM
Done

Nino
avatar Re: Task4C
May 01, 2007 07:09AM
Done...

A Successful Nature Inspires Other People...
Re: Task4C
May 05, 2007 04:57PM
Done.
Re: Task4C
May 07, 2007 09:43AM
There are several php.ini files, how do you know which ones to alter?
Re: Task4C
May 07, 2007 02:25PM
mine is in c:\program files\php.
Re: Task4C
May 08, 2007 10:21PM
Hi Reinie

How did you manage solving your issue, i seem to be experiencing the same problem.

Please advise
Re: Task4C
May 09, 2007 07:29PM
Done. I'm also curious to learn how to make this e-mail thing work. I tried uncommenting sendmail_from and sendmail_path in php.ini and php4.ini to no avail. How do you set up a SMTP server?
avatar
Mac
Re: Task4C
May 10, 2007 04:41PM
You must keep in mind you can not send an email from XAMPP if you are not connected to the I'net. To try to send and receive e-mails is a grey-area that depends on your configuration.

The good news - have a look at the code below - straight forward and guaranteed to work (provided you run your code on a server which is connected to the Internet) - you don't even have to test it:

$mailcontent.= " From: $firstname $lastname\n\n";
$mailcontent.= " Birthdate: $dobYear-$dofMonth-$dofDay \n";
$mailcontent.= " Gender: $gender\n";

$mailcontent.= "\n Contact Details:\n";
$mailcontent.= "\n Telephone: $telephone\n";
$mailcontent.= " Facsimile: $telephone\n";
$mailcontent.= " Mobile: $mobile\n";
$mailcontent.= " E-mail: $email\n";
$mailcontent.= " Amount you can rip from him: $amount\n";

// add as much of the above as you wish.....

//hereunder, I'm sending two emails at once - spot the differences

mail("mac@lotsofmoney.com", "Rip-off chance", $mailcontent, "From: $firstname $lastname <$email> \n Bcc: $INFOADD\n"winking smiley;

mail ($email, "Enquiry", $mailrespcont, "From: Lots of Money Team <crooks@lotsofmoney.com> \n Bcc: $INFOADD\n"winking smiley;

The second email makes use of the following:

$mailrespcont .= "Dear $firstname\n";
$mailrespcont .= "Thank you for your enquiry and your interest in having your money invested with us. Your requirements have been noted and ";
$mailrespcont .= "we will respond with a quotation soonest. Please bear in mind however that each of our letters of response and ";
$mailrespcont .= "accompanying quotes are not 'one size fits all' documents but personally customised to suit each of our clients' ";
$mailrespcont .= "own particular needs. We therefore thank you for your patience.\n\n";


SO what's the difference? The first email is to me, the owner of Lots Of Money, which notifies me that a customer has completed a form. The second is to the customer, thanking him/her for patronage.

PS $INFOADD=someone else. I'm just adding it here to show you how to do it.

Coding HTML-friendly emails - that's another advanced topic. Coding for email clients set to receive either Text and/or HTML messages - eish. Google.
Re: Task4C
May 11, 2007 09:11PM
Thanks for the code, I'm trying it out now... I am indeed connected to the Internets.

My code:
$mailcontent.= " From: $firstname $lastname\n\n";
$mailcontent.= " Age: $age \n";
$mailcontent.= " Preference: $category\n";
$mailcontent.= " email address: $email\n";

mail("lenoremeister@gmail.com", "Bookform Response", $mailcontent,
"From: $firstname $lastname <$email> \n"winking smiley;

My error message:

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\xampp\htdocs\StudentPHP\thankyou.php on line 46

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Program Files\xampp\htdocs\StudentPHP\thankyou.php on line 53
Failed to send the e-mail.

I uncommented/edited the following lines in php.ini in c:\Program Files\xampp\php\ and php.ini in C:\Program Files\xampp\php\php4\ after the first php.ini edit didn't work:
SMTP = localhost
smtp_port = 25
sendmail_from = lenoremeister@gmail.com
sendmail_path = "C:\Program Files\xampp\sendmail\sendmail.exe -t"

I take it these changes are wrong. Which php.ini is the correct one, should I edit it, how should I edit it?


Also, I read the previous posts...

- "Something to do with our local mail server? Using Novell Groupwise"

- "However I thought that the defualt config for php.ini would have initiated my Outlook client"

- "Had to un-comment the "sendmail" option in the php.ini , as well as setup my smtp mail server (smtp.vodacom.co.za) "

Do I need to set up an external SMTP server, or should my internet-connected localhost do the trick? Do I need Outlook express, or should the exercise work regardless? Is there something special I have to do to my computer other than just having Xampp installed?

Thanks for all your help so far!
Still confused but determined Therese
Re: Task4C
May 12, 2007 03:49PM
Hi Therese

Setting your SMTP = localhost in your php.ini file would imply that you are hosting a SMTP (simple mail transfer Protocol) mail server on your PC, which i dont think you are , and hence would not work.

If you use groupwise, often your IT will provide a SMTP/POP server for connection via non MAPI Applications like Outlook Express. You will need to obtain this SMTP address to relay your email out (probably an IP address if its on your internal LAN). If you are connected to the internet via ADSL , you can use the siax SMTP server - smtp.saix.net , or on Vodacom 3G (like me), smtp.vodacom.co.za , or even dialup to mweb on smtp.mweb.co.za.

Hope that helps
J
avatar
Mac
Re: Task4C
May 14, 2007 08:06AM
Being connected to the Internet implies here that you are running the code on a server that is connected to the Internet and that uses the sendmail program (normally sendmail, it could be others).

Your localhost isn't "connected" to the Internet even if you are online. To get XAMPP to send mail, a similar program like sendmail must run on your XAMPP installation. This is tricky,a nd not really required here as part of the prac.

Google for XAMPP and email if you want to investigate.I think you're just going to waste a lot of time trying to get it working (you may be lucky). If I write email code, I upload to the hosting server and then test.
Sorry, only registered users may post in this forum.

Click here to login