We're using swift mailer primarily in context of 'contact-us' & 'submission' forms in our site.
Unfortunately it looks like the only emails that make it through are where the 'from_email' ends in our own site's url..
Sending a note to our host simultaneously about this, but suggestions on the script side?
#####
//Everything looks ok, we can start Swift
require_once "include/Swift.php";
require_once "include/Swift/Connection/SMTP.php";
//Create a Swift instance
$swift =& new Swift(new Swift_Connection_SMTP("localhost"));
//Create the recipient from the details we've been given
$sender =& new Swift_Address($from_email, $from_name);
//Create the message to send
$fullmessage =& new Swift_Message("webmail!");
$fullmessage->attach(new Swift_Message_Part($message));
//Try sending the email
$sent = $swift->send($fullmessage, $to_email, $sender);
//Disconnect from SMTP, we're done
$swift->disconnect();
if ($swift){
//success
header("Location: http://www.theleveebreaking.com/staffcontactsuccess.php");
exit();
} else {
header("Location: http://www.theleveebreaking.com/staffco ... ing_failed");
exit();
}
?>
blocking all urls but our own.. (email from forms)
Moderators: Chris Corbyn, General Moderators
-
rainysurly
- Forum Newbie
- Posts: 3
- Joined: Sun Dec 21, 2008 2:02 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: blocking all urls but our own.. (email from forms)
I'm guessing that your host do not allow relaying for extrnal domains. You may be able to authenticate with a username and password to gain such permissions but really you should never send mail from someone else's address due to spf restrictions. You should use the reply-to header if you need replies to go to the sender. I'll document this in more detail with the next version of swift.
-
rainysurly
- Forum Newbie
- Posts: 3
- Joined: Sun Dec 21, 2008 2:02 am
Re: blocking all urls but our own.. (email from forms)
Thanks Chris, hmmm alternate solution?
How do other folks pull off a 'contact-us' form to email?
I suppose could just have all mail have us as $sender in all applications, just include the from email/name in the message body..
How do other folks pull off a 'contact-us' form to email?
I suppose could just have all mail have us as $sender in all applications, just include the from email/name in the message body..
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: blocking all urls but our own.. (email from forms)
Yes, and there's the setReplyTo() method on the swift message. That way if you hit reply in your mail reader the reply will go to the correct address.rainysurly wrote:I suppose could just have all mail have us as $sender in all applications, just include the from email/name in the message body..
-
rainysurly
- Forum Newbie
- Posts: 3
- Joined: Sun Dec 21, 2008 2:02 am
Re: blocking all urls but our own.. (email from forms)
Thank you thank you Chris for that, -J