Jump to content

Help Me Work This Out


jecs06

Recommended Posts

I'm running php on my local machine (windows xp) and have created the following simple snippet of code:

 

<?php

$to = "jecs06@googlemail.com";

$subject = "Test mail";

$message = "Hello! This is a simple email message.";

$from = "someonelse@example.com";

$headers = "From: $from";

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

echo "Mail Sent.";

?>

 

However, when I load the page, no email is sent.

 

Here is what is in my php.ini file . . . . .

 

 

[mail function]

; For Win32 only.

SMTP = smtp.googlemail.com

smpt_port = 465

 

; For Win32 only.

sendmail_from = pasts@hotmail.com

 

The problem is I can't get it to work and have tried to understand what is going on but due to my lack of knowledge I can't really fix it. Could someone point me in the right direction please.

 

Just to note, I am trying to use googlemail to send the email so was wondering if I needed passwords etc to send it?

 

Could anyone help me please.

 

Regards,

 

JECS06

Link to comment
Share on other sites

I've set php.ini to the following:

 

[mail function]

; For Win32 only.

SMTP = smtp.googlemail.com

smpt_port = 465

 

; For Win32 only.

sendmail_from = jecs06@googlemail.com

 

Still doesn't work and the e-mail address is a valid one, any idea's?

Link to comment
Share on other sites

You can only send mail if the php.ini is set by you isp email account ok.

 

if i was with lets say ball dog it would be somethink like this:

 

[mail function]

; For Win32 only.

SMTP = smtp.bulldog.com

smpt_port = 25

 

; For Win32 only.

sendmail_from = me@bulldog.com

Link to comment
Share on other sites

Gmail smtp requires TLS authentication.

 

The only way I know how to send authenticated mail is using the sockets. ex: fsockopen("tls://....)

 

There might be a way to configure php.ini, but I suggest you consult php documentation on that. It may require other protocols.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.