Sending mail with phpmailer

Hi. I am working on a site through which users can send each other secret emails. Unfortunately, when I use the regular php mail() function, while the emails send, they don’t make it to gmail users. I believe that gmail has blacklisted my server because it thinks they are spam. (They aren’t. The users send the emails themselves.) After reading some posts here on the subject, I have decided to try to use phpmailer and smtp instead. However, I don’t know how to set up smtp for my dreamhost domain. Here is my current code:
$mail = new PHPMailer();
$mail->Host = “”;
$mail->SMTPAuth = true;
$mail->Username = "";
$mail->Password = “mypassword”;
$mail->From = "";
$mail->FromName = “My Site Name”;
$mail->AddReplyTo("", “No Reply”);
$mail->Subject = $subject;
$mail->Body = $message;
echo "Message could not be sent.

echo "Mailer Error: " . $mail->ErrorInfo;
echo “Message has been sent”;
Any idea how to get this to work?

Do you have mailer@mydomain set up as a valid email address hosted at dreamhost?

are you seeing any errors? if so what is the error text?

Yes, I am able to log in to with the username ‘mailer’ and the password ‘mypassword’.

The error I receive is:
Warning: substr() expects parameter 1 to be string, array given in /home/myname/mydomain/vendor/class.phpmailer.php on line 1627
SMTP Error: Could not connect to SMTP host. Message could not be sent.
Mailer Error: SMTP Error: Could not connect to SMTP host.