Hi All
My wesite was built by web design company but since have had a falling out and i am now administoring my site.
My site has a standard contact form which used to send an email to my email account.
These emails have been sent via my old web designers account. How do i change this so they are sent via my email account?
I have looked at eForm.Inc.php and class.phpmailer.php but i cant find any refference to my old web designers email.
I am a noob but do have some experience scripting.
please help
You can configure E-Form with a mail address and additional parameters in the snippet call, check out the E-Form docs here or search for this on the forums, there are lots of examples. If you do no other configuring the phpMailer class defaults to using sendmail, so you may have been using this. Depending on what your new mail set up is you may need to change this to SMTP, this can also be done via parameters to the E-Form snippet.
Use MODx, or the cat gets it!
OK, the mechanism by which your mail was sent via the other address may be a mail server setup on your server, when you say ’sent via’ do you mean you were using their mail server and now you cant? If that’s the case you need another mail account to use here. SMTP needs aserver host as well as an account and password.
You can always do a test send from E-Forms and look at your server mail logs, they should have some info on what’s really happening. What platform are you on?
Use MODx, or the cat gets it!
OK, this line
var $Host = "mail.xxxx.com.au"
I assume is your SMTP mail server host name that you have a mail account on as ’yyyyy’ and ’xxxxx’ below.
You also need to change the ’var $Mailer’ in class.php.mailer to ’smtp’, it defaults to ’mail’ which will try and use sendmail.
By platform I mean OS, are you on windows or linux etc.
Use MODx, or the cat gets it!
Thanks again
My OS is Vista
and i alread set mailer to "var $Mailer = "smtp";
XXXX and yyyy are my username and pasword for my standard email account at mail.xxx.com.au.
BTW
Where are the sever logs? Are they within MODX or are they sitting on me host somewhere? Do i access them via FTP?
Cheers
Quote from: tony_bucko at Mar 13, 2009, 03:43 AM
Yes it was sent via their email server.
i changed these paramenters in class.phpmailer.php
var $Host = "mail.xxxx.com.au";
var $Port = 25;
var $SMTPAuth = true;
var $Username = "yyyyy";
var $Password = "xxxxx";
I thought this might fix it but it doesnt.
Im not sure what platform i am on, do you mean what version of modx am i using?
You need to call IsSMTP() also, otherwise phpmailer defaults to using mail().
Also, you shouldn’t have to hack phpmailer. It’s all settable from outside:
include "path_to_phpmailer_class_file";
$mail = new PHPMailer();
$mail->IsSMTP(); // make phpmaile use SMTP instead of mail()
$mail->SMTPAuth = true; //Turn on SMTP authentication
$mail->Host = $host;
$mail->Port = $port;
$mail->Username = $UserName; //SMTP username
$mail->Password = $Password; //SMTP password
$mail->CharSet = $modx->config['modx_charset'];
$mail->AddAddress($recipient);
$mail->From = $_POST['email'];
$mail->FromName = $site_name;
$mail->Subject = $finalSubject;
$mail->Body = $content;
$mail->AddCustomHeader($addlHeaders); // optional
if(!$mail->send()) {
die("Error in mail" . $mail->ErrorInfo);
}
Hope this helps.
Thanks Bob
It finally worked. For the record i reset my class.phpmailer.php to the original and added Bobs code into my custom mailer.php script.
Although this still doesnt explain why when it was sent via "mail" it defaulted to my old web designers email address.
Im an engineer i need the finite answer.
But the importatnt thing is that it works.
BTW, the email that phpmailer sends has this at the top of the email.
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=""
How do i hide this?
Cheers and thanks again.