PDA

View Full Version : SMTP Contact Addon Help


Blog Master
12-14-2008, 04:34 AM
I am wondering if someone can help me with the final piece of this puzzle? I don't want to use the current contact addon as it uses my hosts mail servers which have been flagged for major spam violations. They are weak mail servers. So... I want to use an SMTP mailer thru my google email account instead. I have written a form for my template's contact page and a form handler to process the form on a separate php page called form-mailer.php. The form looks like such from my contact_template.html file:

<form name="contactform" action="form-mailer.php" method="post">
<p>
<label>Full Name</label>
<input name="Name" value="" type="text" size="30" />
<input type="hidden" name="Required" value="Name,Email,Comments">
<label>Contact Email</label>

<input name="Email" value="" type="text" size="30" />
<label>Your Comments</label>
<textarea name="Comments" rows="5" cols="5"></textarea>
<br />
<input type="submit" value="Send Message" name="submitform"> &nbsp;
</p>
</form>

And the form-mailer.php file contains this code to process the form:

// Edit The following Parameters

$mailTo = "youremail@gmail.com"; // The address that will receive form submissions
$mailSubject = "Incoming Photo Blog Email"; // Whatever you want
$mailHost = "smtp.gmail.com."; // Usually looks like mail.yourhost.com
$mailPort = "25"; // Usually 25
$mailAuth = true; // "true" if your mail server requires authentication, "false" if not
$mailPassword = "myemailpassword"; // The mail password associated with $mailTo


Can someone write an addon file that allows pixelpost users to enter the above in their admin screen and adjust the "form-mailer.php" file to look to the MySQL database for these simple variables so users don't have to edit the php file manually. I would then need to know how to adjust this php file and could release the whole thing as a Contact SMTP addon.

photography
12-14-2008, 06:51 PM
It' in fact very easy to use GMail in this kind of situations. I've never used it with pixelpost, but I did it with the forum I host on my webpage, the configuration is pretty much the same.

First of all check with phpinfo() if your host has configured php to use ssl, tls. You'll have something like that:

Registered Stream Socket Transports: ...., ssl, sslv3, sslv2, tls, ...

If you do, it means you can use gmail service as smtp server. All you have to do is configure the options like this:


// Edit The following Parameters

$mailTo = "youremail@mail.com"; // The address that will receive form submissions
$mailSubject = "Incoming Photo Blog Email"; // Whatever you want
$mailHost = "ssl://smtp.gmail.com"; // Usually looks like mail.yourhost.com
$mailPort = "465"; // Usually 25
$mailAuth = true; // "true" if your mail server requires authentication, "false" if not
$mailPassword = "myemailpassword"; // The mail password associated with $mailTo


What I cannot see above is username; you should also have the username configured to be something like

$mailUser="youremail@gmail.com"

I haven't use this addon, neither downloaded it, I've just pointed out the solution. I hope it will work.

All the best! :)

Blog Master
12-14-2008, 08:27 PM
Photography... Thanks... but I know it works. I am using it now. I just want to release it as an addon for all pixelpost users. I just don't know how to make the php file read the MySQL database so programming challenged users don't have to edit the php file. Can someone qrite an addon that fills in the variables on the php file. Is that possible?

A SMTP addon would rock!