[PHP] problem sending email
hi all,i'm having this problem in sending email using pear. it just wont send :( here's the code .. ?php require_once 'Mail.php'; $from_name = My Self; $to_name = My Friend; $subject = Sending Trial; $mailmsg = GOD please make it work; $From = From: .$from_name. mym...@gmail.com; $To = To: .$to_name. some...@yahoo.com; $recipients = some...@yahoo.com; $headers[From] = $From; $headers[To] = $To; $headers[Subject] = $subject; $headers[Content-Type] = text/plain; charset=iso-8859-1; $smtpinfo[host] = smtp.gmail.com; $smtpinfo[port] = 465; $smtpinfo[auth] = true; $smtpinfo[username] = mym...@gmail.com; $smtpinfo[password] = mypassword; $mail_object = Mail::factory(smtp, $smtpinfo); $mail_object-send($recipients, $headers, $mailmsg); if (PEAR::isError($mail_object)) echo $mail_object-getMessage(); ?
Re: [PHP] problem sending email
On Thu, May 24, 2012 at 2:00 PM, As'ad Djamalilleil asad@gmail.com wrote: hi all,i'm having this problem in sending email using pear. it just wont send :( here's the code .. ?php require_once 'Mail.php'; $from_name = My Self; $to_name = My Friend; $subject = Sending Trial; $mailmsg = GOD please make it work; $From = From: .$from_name. mym...@gmail.com; $To = To: .$to_name. some...@yahoo.com; Don't prefix with From: and To: here. $recipients = some...@yahoo.com; $headers[From] = $From; $headers[To] = $To; $headers[Subject] = $subject; $headers[Content-Type] = text/plain; charset=iso-8859-1; $smtpinfo[host] = smtp.gmail.com; $smtpinfo[port] = 465; $smtpinfo[auth] = true; $smtpinfo[username] = mym...@gmail.com; $smtpinfo[password] = mypassword; $mail_object = Mail::factory(smtp, $smtpinfo); $mail_object-send($recipients, $headers, $mailmsg); if (PEAR::isError($mail_object)) echo $mail_object-getMessage(); ? Also, Gmail SMTP supports only SSL connections. I don't know this PEAR module, but I think you need to host set to something like ssl://smtp.gmail.com, to enforce SSL connection. - Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem sending email message, from Newman.
Below is some code that I have used to send an email Via mail. The message sends with the correct data, HOWEVER my mail server don't like the header and sends the email back to admin. ROUTER: Failure delivering mail message to recipient: [EMAIL PROTECTED] [ROUTER: Unexpected SMTP Server 'ihug.co.nz' [250] received: 550 Syntax error in 'From' header: missing or malformed local part (expected word or ): failing address is: Philip J. Newman] Can anyone help with this $msg = Thanks, $name. Your entry had been added, Good Luck.; $msg .= Email: $email.\n; $msg .= Text: $address, $suburb.\n; $msg .= Answer: $answer; $mailheaders = From: Philip J. Newman\n; $mailheaders .= Reply-To: [EMAIL PROTECTED]\n\n; mail($email, [Newman] Conformation of entry. , $msg, $mailheaders); Philip J. Newman PhilipNZ :: Design Solutions http://www.philipnz.com/ [EMAIL PROTECTED] ICQ# 20482482 +64 25 6144012 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem sending email message, from Newman.
Can you show the contents of the variable $email ? miguel On Wed, 27 Mar 2002, Philip J. Newman wrote: Below is some code that I have used to send an email Via mail. The message sends with the correct data, HOWEVER my mail server don't like the header and sends the email back to admin. ROUTER: Failure delivering mail message to recipient: [EMAIL PROTECTED] [ROUTER: Unexpected SMTP Server 'ihug.co.nz' [250] received: 550 Syntax error in 'From' header: missing or malformed local part (expected word or ): failing address is: Philip J. Newman] Can anyone help with this $msg = Thanks, $name. Your entry had been added, Good Luck.; $msg .= Email: $email.\n; $msg .= Text: $address, $suburb.\n; $msg .= Answer: $answer; $mailheaders = From: Philip J. Newman\n; $mailheaders .= Reply-To: [EMAIL PROTECTED]\n\n; mail($email, [Newman] Conformation of entry. , $msg, $mailheaders); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem sending email message, from Newman.
$email = [EMAIL PROTECTED] example - Original Message - From: Miguel Cruz [EMAIL PROTECTED] To: Philip J. Newman [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 11:14 AM Subject: Re: [PHP] Problem sending email message, from Newman. Can you show the contents of the variable $email ? miguel On Wed, 27 Mar 2002, Philip J. Newman wrote: Below is some code that I have used to send an email Via mail. The message sends with the correct data, HOWEVER my mail server don't like the header and sends the email back to admin. ROUTER: Failure delivering mail message to recipient: [EMAIL PROTECTED] [ROUTER: Unexpected SMTP Server 'ihug.co.nz' [250] received: 550 Syntax error in 'From' header: missing or malformed local part (expected word or ): failing address is: Philip J. Newman] Can anyone help with this $msg = Thanks, $name. Your entry had been added, Good Luck.; $msg .= Email: $email.\n; $msg .= Text: $address, $suburb.\n; $msg .= Answer: $answer; $mailheaders = From: Philip J. Newman\n; $mailheaders .= Reply-To: [EMAIL PROTECTED]\n\n; mail($email, [Newman] Conformation of entry. , $msg, $mailheaders); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem sending email message, from Newman.
Ah, never mind, the problem is that your From: header is invalid. You have: From: Philip J. Newman which is not a valid address format. Try something like this: From: Philip J. Newman [EMAIL PROTECTED] miguel On Wed, 27 Mar 2002, Philip J. Newman wrote: $email = [EMAIL PROTECTED] example - Original Message - From: Miguel Cruz [EMAIL PROTECTED] To: Philip J. Newman [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 27, 2002 11:14 AM Subject: Re: [PHP] Problem sending email message, from Newman. Can you show the contents of the variable $email ? miguel On Wed, 27 Mar 2002, Philip J. Newman wrote: Below is some code that I have used to send an email Via mail. The message sends with the correct data, HOWEVER my mail server don't like the header and sends the email back to admin. ROUTER: Failure delivering mail message to recipient: [EMAIL PROTECTED] [ROUTER: Unexpected SMTP Server 'ihug.co.nz' [250] received: 550 Syntax error in 'From' header: missing or malformed local part (expected word or ): failing address is: Philip J. Newman] Can anyone help with this $msg = Thanks, $name. Your entry had been added, Good Luck.; $msg .= Email: $email.\n; $msg .= Text: $address, $suburb.\n; $msg .= Answer: $answer; $mailheaders = From: Philip J. Newman\n; $mailheaders .= Reply-To: [EMAIL PROTECTED]\n\n; mail($email, [Newman] Conformation of entry. , $msg, $mailheaders); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php