Hi all,
trying to send a basic email from a web feedback document and getting an error on the swift send part.
the swift_mail.php looks like this.
<?php
require_once "/homepages/3/.../htdocs/swift/Swift.php";
require_once "/homepages/3/.../htdocs/swift/Swift/Connection/NativeMail.php";
$to_email = 'myemail@yahoo.com';
$subject = 'subject';
$text = 'From: ' . $_REQUEST['name'] . "\n\n" . $_REQUEST['data'];
$from_email = $_REQUEST['email'];
//Create the message
$message =& new Swift_Message($subject, $text);
//Now send it
$swift->send($message, $from_email, $to_email);
?>
Once the form is submitted I get
Fatal error: Call to a member function send() on a non-object in /homepages/3/d244140422/htdocs/swift_mail.php on line 14
The 'name' 'data' and 'email' are all pulled from the form and are valid.
It worked before with mail() but the messages kept going to junk, I was told by a friend to try swiftmailer.
Any ides where to look, have looked through the forums but i'm new to this and can't see an answer.
Thanks in advance.
Newb problem sending mail from form
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Newb problem sending mail from form
Please read the manual, starting with the tutorials:
http://swiftmailer.org/wikidocs
You've missed a vital step which is shown on almost every page in the documentation
http://swiftmailer.org/wikidocs
You've missed a vital step which is shown on almost every page in the documentation
Re: Newb problem sending mail from form
...which is ??
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Newb problem sending mail from form
Sorry, I'm not trying to be cruel but I'm basically not here to do your reading for you
I'll give you a hint; where did the $swift variable magically appear from?
Re: Newb problem sending mail from form
man you're making this hard for me, i'm not a programmer and never used php before, just trying to use a form as a one off, thought this was a help forum ?
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Newb problem sending mail from form
It is. That's why I'm pointing you to the documentation and telling you exactly which bits of it to read. If you stick around you'll see that we're not really in the habit of writing people's code for them, instead we prefer that people try to understand the code and learn a little by coming here. it's very rewarding to actually learn something new! On all those "tutorial" pages there's a line withhooly69 wrote:man you're making this hard for me, i'm not a programmer and never used php before, just trying to use a form as a one off, thought this was a help forum ?
Code: Select all
$swift = /* something here */Re: Newb problem sending mail from form
i post a note on the forum for help and am told rtfm, forget it, i'll use something else.
Re: Newb problem sending mail from form
I think that's a good idea for you.hooly69 wrote:i post a note on the forum for help and am told rtfm, forget it, i'll use something else.