Advertisement

08.08.2008 at 03:38AM PDT, ID: 23632224 | Points: 500
[x]
Attachment Details

How to send information from a contact form to Outlook using phpmailer and gmail

Asked by CoreSupport in PHP Scripting Language

Tags:

Hi.
I have a contact form on a website and using a php script I can have it sent to my hotmail account. However, I want to send the submitted contact form details to my email account on Microsoft Office Outlook but the information is recognised as spam and is automatically blocked.
I found a solution using phpmailer to send to a gmail account and subsequently gets forwarded to my own email without it being considered spam.
However, since i'm quite new to this, I have no idea how to get it working. I downloaded the phpmailer files from http://sourceforge.net/project/showfiles.php?group_id=26031

Does anyone have any experience with this?

So far my code is as follows:Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
<?php
 
require("phpmailer/class.phpmailer.php");
IsSMTP(); // send via SMTP
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username@googlemail.com"; // SMTP username
$mail->Password = "my password"; // SMTP password
$webmaster_email = "ciaran@mydomain.com"; //Reply to this email ID
$email="username@domain.com"; // Recipients email ID
$name="name"; // Recipient's name
$mail->From = $webmaster_email;
$mail->FromName = "Webmaster";
$mail->AddAddress($email,$name);
$mail->AddReplyTo($webmaster_email,"Webmaster");
$mail->WordWrap = 50; // set word wrap
$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment
$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // attachment
$mail->IsHTML(true); // send as HTML
$mail->Subject = "Demo Request";
$mail->Body=$_POST['Name']
$mail->Body=$_POST['CompanyName']
$mail->Body=$_POST['EmailFrom']
$mail->Body=$_POST['Telephone']
$mail->Body=$_POST['AdditionalInfo']
if(!$mail->Send())
{
  echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
  echo "Message has been sent";
}
?>
 
 
[+][-]08.08.2008 at 03:45AM PDT, ID: 22188757

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 03:52AM PDT, ID: 22188786

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 04:11AM PDT, ID: 22188855

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 04:31AM PDT, ID: 22188944

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 04:43AM PDT, ID: 22188990

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.08.2008 at 05:15AM PDT, ID: 22189135

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628