Forum Moderators: coopster
Sasha
My host also has the Mail() function disabled to deter spammers apparently, and it seems to be this function which all the scripts I can find are using. How then, without using this Mail() function, can I have my contact form submitted and emailed to me?
You can create a socket and connect to port 25 of your mail server (assuming they don't have the port blocked) and then do the SMTP yourself.
>>>Do I really need a Database and Tables just to send a simple form to email?.
No
Take a look at PHP's Mail Functions Page [us3.php.net]. The user-submitted content can point you in a direction that may work for you.
Good luck!
Sasha
I have used this as a straight shot into sendmail, might give you some ideas
function SendmailAPI( $EmailTemplate, $whowhere = 'address@example.com' ){
if( FALSE === ( $pipe_handle = popen( "/usr/lib/sendmail -t -f $whowhere", "w" ) ) )
return( -1 );
$tx = fwrite( $pipe_handle, $EmailTemplate );
pclose( $pipe_handle );
return( $tx );
}
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = grapefruity@hotmail.com <--not my real address
Or do I have to set something here or somewhere so that the mail being sent actually leaves my computer and goes to my I.S.P or something like that to get processed?
I am getting an Error message from my php form-mail script, but I can't tell what is causing the error (doesn't help that the plain-text in the script is in Italiano :o ) but here is a bit of lines from the script where the error is being generated, with what I believe are the english translations for the $variables but I don't know what an 'Intestazioni' is.. It sounds like intestines though..
[b][4]if ($html)
{
$output = getHtmlOutput ($key, $val);
$intestazioni = "MIME-Version: 1.0\r\n";
$intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n";
}
else
{
for ($i = 0; $i < count ($key); $i++)
{
$output .= $key[$i].": ".$val[$i]."\n";
}
$intestazioni = "";
}
if ( (!empty($emailAddress)) ¦¦ (!empty($Name)) )
{
$intestazioni .= "From: ".$Name."<".$emailAddress."> \r\n";
}
else
{
$intestazioni .= "From: ".$Address."\r\n";
}
if (!mail($destination, $subject, $output, $intestazioni))
{
echo "<br>".$AAARGH-The-ERROR-MSSG."<br><br><br>".getHtmlOutput($key, $val)."<br><br><br>".getCredits();
if (strlen($paginaErrore) < 5)
{
exit ();
}
else
{
echo "<META HTTP-EQUIV=Refresh CONTENT=\"10; URL=".$paginaErrore."\">";
}
}
echo "<br>".$messaggioConferma."<br><br><br>".getHtmlOutput($key, $val)."<br><br><br>".getCredits();
[/b][/4] It has been suggested to me that I use 'PhpMailer', and I have it now, but this script looks so much simpler/smaller. it aaalllllmost works :)
Thanks so much everyone!
Sasha
>> will it all work if I upload this stuff to my host
no, because you can't change their php.ini and that is how you set yours up. You also have it set up on your local windows machine. Is your site hosted on a windows box? Those settings are different for win or *nix.
I am noticing though, this script I am using is actually still using the mail () function is it not? Or is this php stuff different than the normal (?) html MAIL() function?
And I guess I have jumped the gun, as my mail had apparently SENT but has definitely not ARRIVED as of yet, its been lika an hour :( boo hoo..
Right: No, my site is currently hosted on Linux, but I hope to move it again very shortly, maybe tonight even, though I see mostly Linux/Apache hosts out there;Pretty common.. Not sure what my potential next host is running on, but I hope to hear back from them soon about whether they will host me or not...
I guess they will (hopefully) have an SMTP server of their own which I will be able to use for this purpose? I realize I cannot change their php.ini file, so... where does this leave me.
Still researching.....
Thanks!
Sasha
much better imo, I was mainly pointing out that your local environment wouldn't be an exact match to your host
>> this script I am using is actually still using the mail () function is it not
yes it is, right here
if (!mail($destination, $subject, $output, $intestazioni))
you just need a host that allows you to use the mail function or gives another alternative so you can send mail from scripts
have you asked your present host if they have an alternative?
Perhaps my best bet is to wait and find out what sort of system Im going to be hosted on next and go from there.
Sasha
Sasha!
(note: the above addresses are phoney baloney)
I can send myself mail any other time using any mail system, so.. Just dunno.
Sasha
ps - Now I am sending FROM:myname@yahoo.com TO:myname@yahoo.com via my sympatico SMTP and no problem, its there in like 5 seconds.
PPS - since I would prefer to use hotmail-to-hotmail ultimately, I think I best get onto this SMTP Authorization stuff and eventually use the MSN SMTP server with my name and password.
[edited by: GrapefruiTgirl at 1:39 pm (utc) on Aug. 2, 2006]
From my experience, Hotmail will block your email if your domain name doesn't have a valid PTR record. Seeing as Hotmail's IP does not match your IP (that you send the email from), they see it as being spoofed.
(That's how I understand it in simple terms, maybe someone will be able to explain better! ;))
Sasha
[edited by: GrapefruiTgirl at 3:09 pm (utc) on Aug. 2, 2006]
Your domain name (i.e. the FROM: address) points to the IP address of the server that hosts it. When Hotmail receives an email it looks up the IP address corresponding to the FROM: domain name. Hotmail then does a reverse DNS lookup on the IP address and should find a PTR record for the domain name in the FROM: address. If there is no PTR record or it is incorrect (as mine is on my shared host :( ), Hotmail simply does not deliver the email. As far as I know, the PTR record is set up by whoever controls the DNS.
And since Hotmail probably assumes that if you're sending email from a Hotmail email address you will be doing so from the Hotmail website, it probably blocks emails with a Hotmail FROM: email address that are not sent from a Hotmail IP address. (I'm just making assumptions here!)
1- Lets say I have my site hosted live somewhere like GrapefruitSite.ReputablePTR.net. Do you suspect I might be able perform mail functions using TO:hotmail.com and FROM:Grapefruitgirl@GrapefruitSite.ReputablePTR.net and have the mail be delivered?
2- assuming the same host, ReputablePTR.net, am I limited in my mail functions, to using the SMTP server (if present) provided by ReputablePTR.net, OR could I continue to route my mail through my own ISP's SMTP server (sympatico) as I currently am, and expect it to be delivered (as opposed to how the mail is currently coming from from my computer's localhost testing server, which is actually connected to my ISP)?
(I guess a simpler way of asking that is: Can just anybody send mail via an ISP's SMTP server, or does a person have to be a customer of the ISP, and be connected via the ISP, to use the ISP's mail server?)
Thanks for any input :)
Sasha
[edited by: GrapefruiTgirl at 1:48 pm (utc) on Aug. 4, 2006]