TechEnclave
Register Now

Registration is free.
Join us today.

Sending email using PHP......

This is a discussion on Sending email using PHP...... within the Programming forums, part of the General Computing category; Ok.... 1st time on PHP today , self learning....managed to configure PHP - do the various settings on IIS and also ...

TechEnclave > General Computing > Programming


Reply
 
LinkBack Thread Tools Display Modes
  #1   hanzy's Rig  
Old 17 Sep 08, 09:43 PM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Sending email using PHP......

Ok....
1st time on PHP today , self learning....managed to configure PHP - do the various settings on IIS and also have PHP read and write to a sample DB on MYSQL......

So at the end of the day , I have managed to read a particular column data and also write to a specific column data....

Now what I am interested in knowing / learning is : How can I have PHP - "mail" me the contents of the user form.....

for example....the php page which i created....opens a page with a txt box...on clicking submit it writes the data to mysql db.....

now what I want to do is have the inputed text 'emailed' to a particular email address...(along with the data going into the DB ).....can it be done ?

or has it to go only to 1 , i.e either the db or either the mail....

looking forward for some help here regarding this.....please post examples with codes and how to go abt it if possible.....

thanks in advance for the assistance.

Reply With Quote
  #2  
Old 18 Sep 08, 12:46 AM
Avtar's Avatar
Steroids Member
 
Join Date: Jan 2005
Age: 20
Posts: 436
Avtar is very NotableAvtar is very NotableAvtar is very Notable
Send a message via AIM to Avtar
Default Re: Sending email using PHP......

The PHP official website is your friend.

PHP: Mail - Manual

Similarly, using the same variables, you can write the data into your database.

Reply With Quote
  #3   hanzy's Rig  
Old 18 Sep 08, 12:52 AM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

View Post
Originally Posted by Avtar
The PHP official website is your friend.

PHP: Mail - Manual

Similarly, using the same variables, you can write the data into your database.
thanks for the assistance , will look into the same......

...anyone and everyone who would know about this right away , pls do help with the same...

Reply With Quote
  #4   hanzy's Rig  
Old 18 Sep 08, 10:41 AM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

View Post
Originally Posted by Avtar
The PHP official website is your friend.

PHP: Mail - Manual

Similarly, using the same variables, you can write the data into your database.
looking throught the thread suggested above....need to figure this out by today afternoon......please assist...

Reply With Quote
  #5  
Old 18 Sep 08, 12:15 PM
Overloaded Member
 
Join Date: Sep 2006
Location: Delhi
Age: 22
Posts: 715
coolraghav is Notablecoolraghav is Notable
Default Re: Sending email using PHP......

mate you can use form mail.

This should do your job...
XPertMailer - Advanced PHP Mail Engine

Reply With Quote
  #6  
Old 18 Sep 08, 12:34 PM
viridian's Avatar
Hyperactive Member
 
Join Date: Jun 2008
Location: Bangalore
Posts: 133
viridian is very Notableviridian is very Notableviridian is very Notable
Send a message via MSN to viridian
Default Re: Sending email using PHP......

Stolen from the Mail manual, shamelessly :-p

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffinated@example.com', 'My Subject', $message);
?>

You'll need to configure the email server like described below.
PHP: Runtime Configuration - Manual

Reply With Quote
  #7   hanzy's Rig  
Old 18 Sep 08, 12:43 PM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

View Post
Originally Posted by viridian
Stolen from the Mail manual, shamelessly :-p

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('caffinated@example.com', 'My Subject', $message);
?>

You'll need to configure the email server like described below.
PHP: Runtime Configuration - Manual


As of now im stuck on 2 error messages....
SMTP server response: 554 5.7.1 <xyz@abc.com>: Recipient address rejected: Access denied
and

Fatal error: Class 'Mail' not found
trying to figure that out...i guess i need to pass the authentication password along with the script as my smtp server needs authentication for outgoing mails......

@viridian : nothing shamless in what u did , its out there for our reference and usuage thanks.

Reply With Quote
  #8   hanzy's Rig  
Old 18 Sep 08, 12:44 PM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

View Post
Originally Posted by coolraghav
mate you can use form mail.

This should do your job...
XPertMailer - Advanced PHP Mail Engine

Checking it out...lets see if it helps.....not checked it yet , but im guessing it might involve some routing via their domain.......just checking....thanks for the reference.

Reply With Quote
  #9  
Old 18 Sep 08, 02:13 PM
Arya's Avatar
Overloaded Member
 
Join Date: Aug 2006
Posts: 822
Arya is highly AdmirableArya is highly AdmirableArya is highly AdmirableArya is highly AdmirableArya is highly AdmirableArya is highly Admirable
Send a message via MSN to Arya Send a message via Yahoo to Arya Send Message via Google Talk to Arya
Default Re: Sending email using PHP......

I think your smtp server is not configured properly. It should allow you to send emails from the address you choose. Which smtp server are you using?

If you want to use an external SMTP server - How to Send Email from a PHP Script Using SMTP Authentication - About Email using PEAR

or

Try Class: SMTP E-mail sending class (smtp, pop3, smtp mail, smtp class) - PHP Classes

Reply With Quote
  #10   hanzy's Rig  
Old 18 Sep 08, 03:28 PM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

Now , I have tried 2-3 different scripts and all of them give me the same error....

Warning: mail() [function.mail]: SMTP server response: 554 5.7.1 <xyz@xyz.com>: Recipient address rejected:
im using remote smtp autentication itself.....

Reply With Quote
  #11   nukeu666's Rig  
Old 18 Sep 08, 03:34 PM
nukeu666's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Wuundersex land
Age: 25
Posts: 2,367
nukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirablenukeu666 is highly Admirable
Send a message via AIM to nukeu666 Send a message via MSN to nukeu666 Send a message via Yahoo to nukeu666 Send Message via Google Talk to nukeu666
Default Re: Sending email using PHP......

the address is rejected because the mailserver cannot find anyone with that address
give a valid email setup on that network

Reply With Quote
  #12  
Old 18 Sep 08, 04:04 PM
viridian's Avatar
Hyperactive Member
 
Join Date: Jun 2008
Location: Bangalore
Posts: 133
viridian is very Notableviridian is very Notableviridian is very Notable
Send a message via MSN to viridian
Default Re: Sending email using PHP......

^^^Agree with nukeu666. Seems like you're asking the mailserver to relay for a domain it's not supposed to.

Reply With Quote
  #13   hanzy's Rig  
Old 18 Sep 08, 04:43 PM
hanzy's Avatar
Explosive Member
 
Join Date: Dec 2006
Location: Earth ! :)
Posts: 1,918
hanzy is very Honorablehanzy is very Honorablehanzy is very Honorablehanzy is very Honorable
Default Re: Sending email using PHP......

^^ i guess thats the issue....

I DO not have a local SMTP server on my PC and I am trying to send external emails to .gmail.com and .yahoo.com domains........and thats why I'm guessing im getting the error messages.

Correct me if I'm wrong , I would need to have the needfull files placed on a configured SMTP server.......

Reply With Quote
Reply


Thread Tools
Display Modes


Welcome, Unregistered.

  
Search
Advertisement


From FunEnclave
Quick Navigation

All times are GMT +5.5. The time now is 06:28 PM.


Style by Safin, exclusive for TechEnclave
Copyright ©2005 - 2008 TechEnclave.com, All Rights Reserved.
Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0