Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Using the mail() function (http://www.go4expert.com/forums/using-mail-function-t5631/)

zdunham6287 3Aug2007 04:51

Using the mail() function
 
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.

pradeep 3Aug2007 14:28

Re: Using the mail() function
 
May be it with your mail settings in php.ini Try using PEAR package http://pear.php.net/package/Mail

vipin.incat 20Aug2007 09:19

Using the E-mail function in VB script
 
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

pradeep 20Aug2007 10:11

Re: Using the mail() function
 
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!

vipin.incat 20Aug2007 13:27

Re: Using the mail() function
 
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

vipin.incat 20Aug2007 13:28

Re: Using the mail() function
 
help me

shabbir 20Aug2007 13:57

Re: Using the mail() function
 
Quote:

Originally Posted by vipin.incat
help me

Help us by having the code block when you have code snippets in your posts.


All times are GMT +5.5. The time now is 03:33.