Using the mail() function

zdunham6287's Avatar, Join Date: Feb 2007
Go4Expert Member
I've been trying to use the mail() function mail a form on my website and it keeps failing, here is the code I'm using:

I did output each of the variables previously to make sure it got the strings from the form and it did get them correctly, so I assumed it must be the mail() call.


PHP Code:
<?php
$firstname 
$_REQUEST['firstname'];
$source $_REQUEST['source'];
$addcorrect $_REQUEST['addcorrect'];
$artist $_REQUEST['artist'];
$album $_REQUEST['album'];
$song $_REQUEST['song'];
$lyrics $_REQUEST['lyrics'];
$sent mail("imanidiot777@gmail.com","Add/Correct Lyrics","$firstname  $source  $addcorrect  $artist  $album  $song  $lyrics","From: $firstname");
if(
$sent)
    {print 
"your message was sent";}
else
    {print 
"your message failed";}
//header("location:addcorrect.html");
?>

Any ideas? Thanks.

Last edited by shabbir; 3Aug2007 at 08:10.. Reason: Code block
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
May be it with your mail settings in php.ini Try using PEAR package http://pear.php.net/package/Mail
0
vipin.incat's Avatar
Newbie Member
Quote:
Originally Posted by pradeep
May be it with your mail settings in php.ini Try using PEAR package http://pear.php.net/package/Mail
hi pradeep,
i have written following code for E-mailing from VB script.
it is asking yes or no confirmation and though after giving confirmation, mail is not going.
can u help me on this and make it automatic.
Code:
Const olFolderContacts = 10
  sDistName = "ipms" 'set the distribution list name here
  
  Set objOutlook = CreateObject("Outlook.Application")
  Set objNamespace = objOutlook.GetNamespace("MAPI")
  
  Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
  intCount = colContacts.Count
  
  For i = 1 To intCount
      If TypeName(colContacts.Item(i)) = "DistListItem" Then
          Set objDistList = colContacts.Item(i)
          sEmails = ""
          If objDistList.DLName = sDistName Then
              For j = 1 To objDistList.MemberCount
                  sEmails = sEmails & ";" & objDistList.GetMember(j).Address
              Next
              
              'send the mail using the emails u got! ;-) enjoy
          End if
      End If
  Next
regards,
vipin gupta

Last edited by shabbir; 20Aug2007 at 09:59.. Reason: Code block
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
You are not calling any send method, how do you expect the mail to be dispatched! All i can see is you are collecting contacts!
0
vipin.incat's Avatar
Newbie Member
actually sir,
i am working with automation and i need to send any e-mail or message on any mobile, on some critical event failure. what my software can do is integration with Vb-script.
can u help me on this code .
what i written is this:-
Code:
Sub OnMouseUp(x As Long, y As Long, flags As Long)
Dim objOutlookMsg As Object
Const olFolderContacts = 10
  sDistName = "ipms" 'set the distribution list name here
  
  Set objOutlook = CreateObject("Outlook.Application")
  Set objNamespace = objOutlook.GetNamespace("MAPI")
   Set objOutlookMsg = objOutlook.CreateItem(0)
  Set colContacts = objNamespace.GetDefaultFolder(olFolderContacts).Items
  intCount = colContacts.Count
	   For i = 1 To intCount
      If TypeName(colContacts.Item(i)) = "DistListItem" Then
          Set objDistList = colContacts.Item(i)
          sEmails = ""
          If objDistList.DLName = sDistName Then
              For j = 1 To objDistList.MemberCount
                  sEmails = sEmails & ";" & objDistList.GetMember(j).Address
              Next
  	  with objOutlookMsg.To="vipin.gupta@incat.com"
              
              			  with objOutlookMsg.send

			          End If
      End If
  Next

End Sub
so can u

Last edited by shabbir; 20Aug2007 at 13:51.. Reason: Code block
0
vipin.incat's Avatar
Newbie Member
help me
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by vipin.incat
help me
Help us by having the code block when you have code snippets in your posts.