1

I have a very peculiar problem... I have a Ubuntu Server 12.04 with LAMP installed and ssmtp installed and configured properly... Now I can send mails from my terminal with and without sudo. This tells me that my ssmtp configuration is correct.

I can send mail from my php script using:

mail('[email protected]',$subject,$message);

But, when I replace the toEmail with a variable containing the string of the email, I want to send to, like:

mail($to,$subject,$message);

Then in this case the mail is not sent, and instead gmail tells me that I have entered the wrong address... Gmail displays that address as '[email protected]'... While in the first case the address in the email which is received, is received without quotes...

I have searched a lot and I just cant find an answer...

This is the message I receive:

Delivery to the following recipient failed permanently:
    '[email protected]'
2
  • How are you assigning the $to variable? What's that line of code look like?
    – Ed Manet
    Dec 23, 2012 at 23:28
  • it looks like this $to=strval($_GET['email']); its fetched through the URL of the web service this code is present in... and in the URL the value shows up as email='[email protected]'
    – ArslanW
    Dec 23, 2012 at 23:55

1 Answer 1

1

With a little head banging I have been able to solve this problem...The trick is to send the email in the URL without the quotes...Example:

http://10.1.1.11/[email protected]

NOw the email in here is without the quotes... Now the mail() function in PHP will work with ssmtp, but the database queries wont. For database queries to work with the variable the email will be stored in, you just have to add single quotes around it...Cheers!

1
  • Exactly where I what I thought it was.
    – Ed Manet
    Dec 24, 2012 at 14:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .