...

View Full Version : Sending email from another server



tp1899
10-30-2007, 09:53 PM
Hey everyone!

I have a small problem and I was hoping that someone here could help me. Here it goes:

I'm hosting a website on a server that doesn't support mail() function. It's disabled or something and I have no way of contacting the webmaster to enable it or anything.

This company I'm doing this website for wants a contact form on their website. How do I do this? Is it possible that I could somehow forward data that user enters on the clients server to my server and use mail() function from my server?

Hope you know what I want. Thanks for any help.

Have a nice day,

T

GJay
10-30-2007, 10:07 PM
you could, or you could connect to an SMTP server and do it that way. something like Zend_Mail (a component of the Zend Framework) lets you do this quite easily:


<?php
require_once 'Zend/Mail.php';
require_once 'Zend/Mail/Transport/Smtp.php';

$config = array('auth' => 'login',
'username' => 'myusername',
'password' => 'password');

$transport = new Zend_Mail_Transport_Smtp('mail.server.com', $config);

$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('sender@test.com', 'Some Sender');
$mail->addTo('recipient@test.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($transport);

http://framework.zend.com/manual/en/zend.mail.html

tp1899
10-30-2007, 11:07 PM
Thanks for this. I found another php mail class called phpmailer (there's also swiftmailer) that supports SMTP authentication.

Have fun,

T



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum